code: def fail_once(result: Any):
      class _Failer:
          def __init__(self):
              self.failed = False
  
          def __call__(self, *args, **kwargs):
              if not self.failed:
                  self.failed = True
                  raise UnitTestError()
              return result
  
      return _Failer()
  
file_path: ray/release/ray_release/tests/utils.py
imports: from collections import Counter
  from typing import Any
label_desc: Use image node_id 2 for calling a global function with example usage: fail_once(result) and returns: _Failer, result