<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_uri(self, text: str) -> URIRef: """ Parse input text into URI :param text: can be one of 1. URI, directly return 2. prefix:name, query namespace for prefix, return expanded URI 3. name, use default namespace to expand it and return it :return: URIRef """

        if self.check_uriref(text):
            return self.check_uriref(text)
        elif isinstance(text, str):
            text = text.strip()
            m = URI_ABBR_PATTERN.match(text)
            if m:
                prefix, name = m.groups()
                base = self.store.namespace(prefix if prefix else '')
                if not base:
                    raise PrefixNotFoundException("Prefix: %s", prefix)
                return URIRef(base + name)
        raise WrongFormatURIException()