def id_token(access_token, nonce=None, claims_request=None):
    """
    Returns data required for an OpenID Connect ID Token according to:

    - http://openid.net/specs/openid-connect-basic-1_0.html#IDToken

    Arguments:
        access_token (:class:`AccessToken`): Associated OAuth2 access token.
        nonce (str): Optional nonce to protect against replay attacks.
        claims_request (dict): Optional dictionary with the claims request parameters.

    Information on the `claims_request` parameter specification:

    - http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter

    Returns an :class:`IDToken` instance with the scopes from the
    access_token and the corresponding claims. Claims in the
    `claims_request` paramater id_token section will be included *in
    addition* to the ones corresponding to the scopes specified in the
    `access_token`.

    """

    handlers = HANDLERS['id_token']

    # Select only the relevant section of the claims request.
    claims_request_section = claims_request.get('id_token', {}) if claims_request else {}

    scope_request = provider.scope.to_names(access_token.scope)

    if nonce:
        claims_request_section.update({'nonce': {'value': nonce}})

    scopes, claims = collect(
        handlers,
        access_token,
        scope_request=scope_request,
        claims_request=claims_request_section,
    )

    return IDToken(access_token, scopes, claims)
Returns data required for an OpenID Connect ID Token according to:

    - http://openid.net/specs/openid-connect-basic-1_0.html#IDToken

    Arguments:
        access_token (:class:`AccessToken`): Associated OAuth2 access token.
        nonce (str): Optional nonce to protect against replay attacks.
        claims_request (dict): Optional dictionary with the claims request parameters.

    Information on the `claims_request` parameter specification:

    - http://openid.net/specs/openid-connect-core-1_0.html#ClaimsParameter

    Returns an :class:`IDToken` instance with the scopes from the
    access_token and the corresponding claims. Claims in the
    `claims_request` paramater id_token section will be included *in
    addition* to the ones corresponding to the scopes specified in the
    `access_token`.