code: def SetName(obj, name):
    
    # Not doing type assertion on obj, since it may be a mock object used
    # in tests.
    precondition.AssertType(name, str)
  
    if PY2:
      obj.__name__ = name.encode("ascii")
    else:
      obj.__name__ = name
docs: A compatibility wrapper for setting object's name.
  
    See documentation for `GetName` for more information.
  
    Args:
      obj: A type or function object to set the name for.
      name: A name to set.