<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def authorize(self, scope=None, redirect_uri=None, state=None):
 """ Redirect to GitHub and request access to a user's data. :param scope: List of `Scopes`_ for which to request access, formatted as a string or comma delimited list of scopes as a string. Defaults to ``None``, resulting in granting read-only access to public information (includes public user profile info, public repository info, and gists). For more information on this, see the examples in presented in the GitHub API `Scopes`_ documentation, or see the examples provided below. :type scope: str :param redirect_uri: `Redirect URL`_ to which to redirect the user after authentication. Defaults to ``None``, resulting in using the default redirect URL for the OAuth application as defined in GitHub. This URL can differ from the callback URL defined in your GitHub application, however it must be a subdirectory of the specified callback URL, otherwise raises a :class:`GitHubError`. For more information on this, see the examples in presented in the GitHub API `Redirect URL`_ documentation, or see the example provided below. :type redirect_uri: str :param state: An unguessable random string. It is used to protect against cross-site request forgery attacks. :type state: str For example, if we wanted to use this method to get read/write access to user profile information, in addition to read-write access to code, commit status, etc., we would need to use the `Scopes`_ ``user`` and ``repo`` when calling this method. .. code-block:: python github.authorize(scope="user,repo") Additionally, if we wanted to specify a different redirect URL following authorization. .. code-block:: python # Our application's callback URL is "http://example.com/callback" redirect_uri="http://example.com/callback/my/path" github.authorize(scope="user,repo", redirect_uri=redirect_uri) .. _Scopes: https://developer.github.com/v3/oauth/#scopes .. _Redirect URL: https://developer.github.com/v3/oauth/#redirect-urls """

        _logger.debug("Called authorize()")
        params = {'client_id': self.client_id}
        if scope:
            params['scope'] = scope
        if redirect_uri:
            params['redirect_uri'] = redirect_uri
        if state:
            params['state'] = state

        url = self.auth_url + 'authorize?' + urlencode(params)
        _logger.debug("Redirecting to %s", url)
        return redirect(url)