code: def override_to_local_variable(enable=True):
      """
      Returns:
          a context where all variables will be created as local.
      """
      if enable:
  
          def custom_getter(getter, name, *args, **kwargs):
              _replace_global_by_local(kwargs)
              return getter(name, *args, **kwargs)
  
          with custom_getter_scope(custom_getter):
              yield
      else:
          yield
  
imports: import operator
  from contextlib import contextmanager
  import tensorflow
  import threading
  from ..compat import tfv1
  from ..tfutils.common import get_tf_version_tuple
  from ..tfutils.scope_utils import cached_name_scope, under_name_scope
  from ..tfutils.varreplace import custom_getter_scope
  from ..utils import logger
  from ..utils.argtools import call_only_once
label_desc: Use image node_id 3 for calling a global function with example usage: override_to_local_variable(enable) and returns: getter