code: def prefix(self, imod: YangIdentifier, mid: ModuleId) -> YangIdentifier:
          
          try:
              did = (imod, self.implement[imod])
          except KeyError:
              raise ModuleNotImplemented(imod) from None
          try:
              pmap = self.modules[mid].prefix_map
          except KeyError:
              raise ModuleNotRegistered(*mid) from None
          for p in pmap:
              if pmap[p] == did:
                  return p
          raise ModuleNotImported(imod, mid)
docs: Return the prefix corresponding to an implemented module.
  
          Args:
              imod: Name of an implemented module.
              mid: Identifier of the context module.
  
          Raises:
              ModuleNotImplemented: If `imod` is not implemented.
              ModuleNotRegistered: If `mid` is not registered in YANG library.
              ModuleNotImported: If `imod` is not imported in `mid`.