'Get the first available tenant name (usually there are only one)'

def _get_tenant_name(self, token):

    headers = {'Accept': 'application/json', 'Content-Type': 'application/json', 'X-Auth-Token': token}
    response = self.request('/v2.0/tenants', headers=headers, method='GET')
    if (response.status == httplib.UNAUTHORIZED):
        raise InvalidCredsError()
    elif (response.status in [httplib.OK, httplib.CREATED]):
        try:
            body = json.loads(response.body)
            return body['tenants'][0]['name']
        except Exception:
            e = sys.exc_info()[1]
            raise MalformedResponseError('Failed    to    parse    JSON', e)
    else:
        raise MalformedResponseError('Malformed    response', driver=self.driver)
