<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def canonical_key(self, key):
 """Returns the canonical key for the given ``key``."""

        if key.startswith('/'):
            return urlparse.urljoin(self.base_uri, key)
        else:
            return self.curies.expand(key)