def maybe_singleton(py_object):
  """Returns `True` if `py_object` might be a singleton value .

  Many immutable values in python act like singletons: small ints, some strings,
  Bools, None, the empty tuple.

  We can't rely on looking these up by their `id()` to find their name or
  duplicates.

  This function checks if the object is one of those maybe singleton values.

  Args:
    py_object: the object to check.

  Returns:
    A bool, True if the object might be a singleton.
  """
  # isinstance accepts nested tuples of types.
  immutable_types = (int, str, bytes, float, complex, bool, type(None))
  is_immutable_type = isinstance(py_object, immutable_types)

  # Check if the object is the empty tuple.
  return is_immutable_type or py_object is ()  # pylint: disable=literal-comparison