import threading


def _get_internal_name(name):
  """Returns the internal thread-local name of an attribute based on its id.

  For each specified attribute, we create an attribute whose name depends on
  the current thread's id to store thread-local value for that attribute. This
  method provides the name of this thread-specific attribute.

  Args:
    name: str, name of the exposed attribute.
  Returns:
    str, name of the internal attribute storing thread local value.
  """
  return '__' + name + '_' + str(threading.current_thread().ident)