'Extract a FetchRequest from an OpenID message
@param openid_request: The OpenID authentication request
containing the attribute fetch request
@type openid_request: C{L{openid.server.server.CheckIDRequest}}
@rtype: C{L{FetchRequest}} or C{None}
@returns: The FetchRequest extracted from the message or None, if
the message contained no AX extension.
@raises KeyError: if the AuthRequest is not consistent in its use
of namespace aliases.
@raises AXError: When parseExtensionArgs would raise same.
@see: L{parseExtensionArgs}'

def fromOpenIDRequest(cls, openid_request):

    message = openid_request.message
    ax_args = message.getArgs(cls.ns_uri)
    self = cls()
    try:
        self.parseExtensionArgs(ax_args)
    except NotAXMessage as err:
        return None
    if self.update_url:
        realm = message.getArg(OPENID_NS, 'realm', message.getArg(OPENID_NS, 'return_to'))
        if (not realm):
            raise AXError((('Cannot    validate    update_url    %r    ' + 'against    absent    realm') % (self.update_url,)))
        tr = TrustRoot.parse(realm)
        if (not tr.validateURL(self.update_url)):
            raise AXError(('Update    URL    %r    failed    validation    against    realm    %r' % (self.update_url, realm)))
    return self
