code: def is_side_effect_safe(m: MutableLocalBase):
      scope_id = current_scope_id()
  
      # In the top-level scope (if no HigherOrderOperators are involved),
      # we are allowed to modify variables created in this scope as well
      # as existing variables.
      if _is_top_level_scope(scope_id):
          return True
      # Otherwise, only allow local mutation of variables created in the current scope
      return m.scope == scope_id
  
imports: import collections
  from enum import Enum
  from typing import Any, Callable, Dict, List
  from ..None import variables
  from ..current_scope_id import current_scope_id
  from ..exc import unimplemented
  from ..source import AttrSource, Source
  from ..utils import identity, istype
label_desc: Use image node_id 2 for calling a global function with example usage: is_side_effect_safe(m) and returns: unknown, True