'If for some reason an ansible-galaxy token was left from a prior login, remove it. We cannot
retrieve the token after creation, so we are forced to create a new one.'

def remove_github_token(self):

    try:
        tokens = json.load(open_url(self.GITHUB_AUTH, url_username=self.github_username, url_password=self.github_password, force_basic_auth=True))
    except HTTPError as e:
        res = json.load(e)
        raise AnsibleError(res['message'])
    for token in tokens:
        if (token['note'] == 'ansible-galaxy    login'):
            display.vvvvv(('removing    token:    %s' % token['token_last_eight']))
            try:
                open_url(('https://api.github.com/authorizations/%d' % token['id']), url_username=self.github_username, url_password=self.github_password, method='DELETE', force_basic_auth=True)
            except HTTPError as e:
                res = json.load(e)
                raise AnsibleError(res['message'])
