<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def access_token_response_data(self, access_token, response_type=None, nonce=''):
 """ Return `access_token` fields for OAuth2, and add `id_token` fields for OpenID Connect according to the `access_token` scope. """


        # Clear the scope for requests that do not use OpenID Connect.
        # Scopes for pure OAuth2 request are currently not supported.
        scope = constants.DEFAULT_SCOPE

        extra_data = {}

        # Add OpenID Connect `id_token` if requested.
        #
        # TODO: Unfourtunately because of how django-oauth2-provider implements
        # scopes, we cannot check if `openid` is the first scope to be
        # requested, as required by OpenID Connect specification.

        if provider.scope.check(constants.OPEN_ID_SCOPE, access_token.scope):
            id_token = self.get_id_token(access_token, nonce)
            extra_data['id_token'] = self.encode_id_token(id_token)
            scope = provider.scope.to_int(*id_token.scopes)

        # Update the token scope, so it includes only authorized values.
        access_token.scope = scope
        access_token.save()

        # Get the main fields for OAuth2 response.
        response_data = super(AccessTokenView, self).access_token_response_data(access_token)

        # Add any additional fields if OpenID Connect is requested. The order of
        # the addition makes sures the OAuth2 values are not overrided.
        response_data = dict(extra_data.items() + response_data.items())

        return response_data