code: def cleanup(teardown):
      """Register a function to be called when the current test has finished
      executing. Any exceptions thrown in teardown will be printed but not
      rethrown.
  
      Inside a test this isn't very interesting, because you can just use
      a finally block, but note that you can use this inside map, flatmap,
      etc. in order to e.g. insist that a value is closed at the end.
      """
      context = _current_build_context.value
      if context is None:
          raise InvalidArgument(
              "Cannot register cleanup outside of build context"
          )
      context.tasks.append(teardown)
  
imports: import math
  from collections import defaultdict
  from typing import NoReturn, Union
  from weakref import WeakKeyDictionary
  from hypothesis import Verbosity, settings
  from hypothesis._settings import note_deprecation
  from hypothesis.errors import InvalidArgument, UnsatisfiedAssumption
  from hypothesis.internal.compat import BaseExceptionGroup
  from hypothesis.internal.conjecture.data import ConjectureData
  from hypothesis.internal.reflection import get_pretty_function_description
  from hypothesis.internal.validation import check_type
  from hypothesis.reporting import report, verbose_report
  from hypothesis.utils.dynamicvariables import DynamicVariable
  from hypothesis.vendor.pretty import IDKey
label_desc: Use image node_id 5 for calling a global function with example usage: cleanup(teardown) without return types