<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def translate_node_id(self, ni: PrefName, sctx: SchemaContext) -> QualName: """Translate node identifier to a qualified name. Args: ni: Node identifier (with optional prefix). sctx: SchemaContext. Raises: ModuleNotRegistered: If `mid` is not registered in the data model. UnknownPrefix: If the prefix specified in `ni` is not declared. """

        p, s, loc = ni.partition(":")
        if not s:
            return (ni, sctx.default_ns)
        try:
            mdata = self.modules[sctx.text_mid]
        except KeyError:
            raise ModuleNotRegistered(*sctx.text_mid) from None
        try:
            return (loc, self.namespace(mdata.prefix_map[p]))
        except KeyError:
            raise UnknownPrefix(p, sctx.text_mid) from None