def registerNamespaceAlias(namespace_uri, alias):
    """
    Registers a (namespace URI, alias) mapping in a global namespace
    alias map.  Raises NamespaceAliasRegistrationError if either the
    namespace URI or alias has already been registered with a
    different value.  This function is required if you want to use a
    namespace with an OpenID 1 message.
    """
    global registered_aliases

    if registered_aliases.get(alias) == namespace_uri:
        return

    if namespace_uri in list(registered_aliases.values()):
        raise NamespaceAliasRegistrationError(
            'Namespace uri %r already registered' % (namespace_uri, ))

    if alias in registered_aliases:
        raise NamespaceAliasRegistrationError('Alias %r already registered' %
                                              (alias, ))

    registered_aliases[alias] = namespace_uri