code: def addAlias(self, namespace_uri, desired_alias, implicit=False):
          
          if isinstance(namespace_uri, bytes):
              namespace_uri = str(namespace_uri, encoding="utf-8")
          # Check that desired_alias is not an openid protocol field as
          # per the spec.
          assert desired_alias not in OPENID_PROTOCOL_FIELDS, \
                 "%r is not an allowed namespace alias" % (desired_alias,)
  
          # Check that desired_alias does not contain a period as per
          # the spec.
          if isinstance(desired_alias, str):
              assert '.' not in desired_alias, \
                     "%r must not contain a dot" % (desired_alias,)
  
          # Check that there is not a namespace already defined for
          # the desired alias
          current_namespace_uri = self.alias_to_namespace.get(desired_alias)
          if (current_namespace_uri is not None and
                  current_namespace_uri != namespace_uri):
  
              fmt = ('Cannot map %r to alias %r. '
                     '%r is already mapped to alias %r')
  
              msg = fmt % (namespace_uri, desired_alias, current_namespace_uri,
                           desired_alias)
              raise KeyError(msg)
  
          # Check that there is not already a (different) alias for
          # this namespace URI
          alias = self.namespace_to_alias.get(namespace_uri)
          if alias is not None and alias != desired_alias:
              fmt = ('Cannot map %r to alias %r. '
                     'It is already mapped to alias %r')
              raise KeyError(fmt % (namespace_uri, desired_alias, alias))
  
          assert (desired_alias == NULL_NAMESPACE or
                  type(desired_alias) in [str, str]), repr(desired_alias)
          assert namespace_uri not in self.implicit_namespaces
          self.alias_to_namespace[desired_alias] = namespace_uri
          self.namespace_to_alias[namespace_uri] = desired_alias
          if implicit:
              self.implicit_namespaces.append(namespace_uri)
          return desired_alias
docs: Add an alias from this namespace URI to the desired alias