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: from __future__ import absolute_import, division, print_function
  import math
  import traceback
  from hypothesis import Verbosity, settings
  from hypothesis.errors import CleanupFailed, InvalidArgument, UnsatisfiedAssumption
  from hypothesis.internal.compat import string_types
  from hypothesis.internal.conjecture.data import ConjectureData
  from hypothesis.internal.validation import check_type
  from hypothesis.reporting import report, verbose_report
  from hypothesis.utils.dynamicvariables import DynamicVariable
label_desc: Use image node_id 4 for calling a global function with example usage: cleanup(teardown) without return types