code: def _check_not_called_concurrently(lock):
      """Checks the returned context is not executed concurrently with any other."""
      if not lock.acquire(False):  # Non-blocking.
          raise RuntimeError(
              "Detected concurrent execution of TFPyMetric ops."
          )
      try:
          yield
      finally:
          lock.release()
  
file_path: agents/tf_agents/metrics/tf_py_metric.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import contextlib
  import threading
  import tensorflow
  from tf_agents.metrics import tf_metric
label_desc: Use image node_id 1 for calling a global function with example usage: _check_not_called_concurrently(lock) without return types