def get_tenant(keystone, name):
 tenants = [x for x in keystone.tenants.list() if (x.name == name)]
 count = len(tenants)
 if (count == 0):
  raise KeyError(('No keystone tenants with name %s' % name))
 elif (count > 1):
  raise ValueError(('%d tenants with name %s' % (count, name)))
 else:
  return tenants[0]

def get_tenant ( keystone , name ) : tenants = [ x for x in keystone . tenants . list ( ) if ( x . name == name ) ] count = len ( tenants ) if ( count == 0 ) : raise KeyError ( ( 'No keystone tenants with name %s' % name ) ) elif ( count > 1 ) : raise ValueError ( ( '%d tenants with name %s' % ( count , name ) ) ) else : return tenants [ 0 ]
retrieve a tenant by name .