code: def ensure_removed(obj, attr):
      """Ensure that an attribute added to 'obj' during the test is
      removed when we're done"""
      try:
          yield
      finally:
          try:
              delattr(obj, attr)
          except AttributeError:
              pass
          obj._accessors.discard(attr)
  
imports: from __future__ import annotations
  import contextlib
  import numpy
  import pytest
  import dask.dataframe
  from dask.dataframe._compat import PANDAS_GE_140, PANDAS_GE_210
  from dask.dataframe._pyarrow import to_pyarrow_string
  from dask.dataframe.utils import assert_eq, pyarrow_strings_enabled
label_desc: Use image node_id 1 for calling a global function with example usage: ensure_removed(obj, attr) without return types