'Check if the token belongs to the right project.
:param token: token reference
:param belongs_to: project ID that the token belongs to'

def _token_belongs_to(self, token, belongs_to):

    token_data = token['access']['token']
    if (('tenant' not in token_data) or (token_data['tenant']['id'] != belongs_to)):
        raise exception.Unauthorized()
