It is currently a bit cumbersome to obtain a (Core)SWHID instance out of swh.model.from_disk classes like Content and Directory, but there is client code that needs to do so (e.g., in swh-identify and swh-scanner).
It would be nice to have a dedicated swhid() method on those classes to make that easy.