def _build_user_auth(token=None, user_id=None, username=None, password=None, tenant_id=None, tenant_name=None, trust_id=None):
 auth_json = {}
 if (token is not None):
  auth_json['token'] = token
 if (username or password):
  auth_json['passwordCredentials'] = {}
 if (username is not None):
  auth_json['passwordCredentials']['username'] = username
 if (user_id is not None):
  auth_json['passwordCredentials']['userId'] = user_id
 if (password is not None):
  auth_json['passwordCredentials']['password'] = password
 if (tenant_name is not None):
  auth_json['tenantName'] = tenant_name
 if (tenant_id is not None):
  auth_json['tenantId'] = tenant_id
 if (trust_id is not None):
  auth_json['trust_id'] = trust_id
 return auth_json

def _build_user_auth ( token = None , user_id = None , username = None , password = None , tenant_id = None , tenant_name = None , trust_id = None ) : auth_json = { } if ( token is not None ) : auth_json [ 'token' ] = token if ( username or password ) : auth_json [ 'passwordCredentials' ] = { } if ( username is not None ) : auth_json [ 'passwordCredentials' ] [ 'username' ] = username if ( user_id is not None ) : auth_json [ 'passwordCredentials' ] [ 'userId' ] = user_id if ( password is not None ) : auth_json [ 'passwordCredentials' ] [ 'password' ] = password if ( tenant_name is not None ) : auth_json [ 'tenantName' ] = tenant_name if ( tenant_id is not None ) : auth_json [ 'tenantId' ] = tenant_id if ( trust_id is not None ) : auth_json [ 'trust_id' ] = trust_id return auth_json
build auth dictionary .