<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def SetName(obj, name):
 """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. """

  # 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