code: def _is_allowed():
      # Returns whether device synchronization is allowed in the current thread.
      try:
          return _thread_local.allowed
      except AttributeError:
          _thread_local.allowed = True
          return True
  
file_path: cupy/cupy/_core/syncdetect.py
imports: import contextlib
  import threading
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: _is_allowed() and returns: _thread_local, True