code: def local_env(key, default=None, use_default_if_none=False):
      """
      Look up and return the value associated with the given key in the thread context.
  
      :param key: the key to look up in the thread context.
      :param default: the default value of key was not found in the thread context (defaults to None).
      :param use_default_if_none: also return the default value if the key exists with a None value (defaults to False).
      :return: the value for the given key attached to the thread context
               or the default value if the key was not present in the thread context.
      """
      context = _get_local(copy=False)
      value = context.get(key, default)
      return default if use_default_if_none and value is None else value
  
imports: from contextlib import contextmanager
  import threading
label_desc: Use image node_id 3 for calling a global function with example usage: local_env(key, default, use_default_if_none) and returns: unknown