def get_key_reference(scope, name, user=None):
 if ((scope == SYSTEM_SCOPE) or (scope == FULL_SYSTEM_SCOPE)):
  return name
 elif ((scope == USER_SCOPE) or (scope == FULL_USER_SCOPE)):
  if (not user):
   raise InvalidUserException('A valid user must be specified for user key ref.')
  return UserKeyReference(name=name, user=user).ref
 else:
  raise InvalidScopeException(('Scope "%s" is not valid. Allowed scopes are %s.' % (scope, ALLOWED_SCOPES)))

def get_key_reference ( scope , name , user = None ) : if ( ( scope == SYSTEM_SCOPE ) or ( scope == FULL_SYSTEM_SCOPE ) ) : return name elif ( ( scope == USER_SCOPE ) or ( scope == FULL_USER_SCOPE ) ) : if ( not user ) : raise InvalidUserException ( 'A valid user must be specified for user key ref.' ) return UserKeyReference ( name = name , user = user ) . ref else : raise InvalidScopeException ( ( 'Scope "%s" is not valid. Allowed scopes are %s.' % ( scope , ALLOWED_SCOPES ) ) )
given a key name and user this method returns a new name to address the key value pair in the context of that user .