Making it strict by respecting the documented grammar [1]
Currently, it misses some checks on:
- D4461: the context qualifier (origin, visit, ...) so anybody can provide noisy swhid and be fine with it
- D4462: whitespaces that should be refused anywhere in the string and it's not
It should also raise when those invalid SWHIDs are provided [2]
The end goal being to avoid another parsing layer in other swh users of that function.
[1] https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html#syntax
[2] D4442#110837