code: def get_token(url_base, tenant_id, user, password):
      
      url = 'http://' + url_base + '/v2.0/tokens'
      headers = {'Content-Type': 'application/json'}
      payload = '{"auth":{"tenantId":"' + tenant_id +\
                '","passwordCredentials":{"username":"'\
                + user + '","password":"' + password + '"}}}'
      response = requests.post(url, headers=headers, data=payload)
      if response.status_code != 200:
          print 'error to obtain the token ' + str(response.status_code)
          exit(1)
      response_json = response.json()
      token = response_json['access']['token']['id']
      return token
docs: It obtains a valid token.
      :param url_base: keystone url
      :param tenand_id: the id of the tenant
      :param user: the user
      :param paassword: the password