'Obtain an authorization token.
The retrieved token will allow future consumers to use the API without
a username and password.
:param str username: (required)
:param str password: (required)
:param list scopes: (optional), areas you want this token to apply to,
i.e., \'gist\', \'user\'
:param str note: (optional), note about the authorization
:param str note_url: (optional), url for the application
:param str client_id: (optional), 20 character OAuth client key for
which to create a token
:param str client_secret: (optional), 40 character OAuth client secret
for which to create the token
:returns: :class:`Authorization <Authorization>`'

def authorize(self, username, password, scopes=None, note=u'', note_url=u'', client_id=u'', client_secret=u''):

    json = None
    if (username and password):
        url = self._build_url(u'authorizations')
        data = {u'note': note, u'note_url': note_url, u'client_id': client_id, u'client_secret': client_secret}
        if scopes:
            data[u'scopes'] = scopes
        with self.session.temporary_basic_auth(username, password):
            json = self._json(self._post(url, data=data), 201)
    return self._instance_or_null(Authorization, json)
