code: def _register_accessor(name, cls):
      def decorator(accessor):
          if hasattr(cls, name):
              warnings.warn(
                  "registration of accessor {!r} under name {!r} for type "
                  "{!r} is overriding a preexisting attribute with the same "
                  "name.".format(accessor, name, cls),
                  UserWarning,
                  stacklevel=2,
              )
          setattr(cls, name, CachedAccessor(name, accessor))
          cls._accessors.add(name)
          return accessor
  
      return decorator
  
imports: from __future__ import annotations
  import warnings
  import numpy
  import pandas
  from dask.dataframe._compat import check_to_pydatetime_deprecation
  from dask.utils import derived_from
label_desc: Use image node_id 7 for calling a global function with example usage: _register_accessor(name, cls) and returns: decorator, accessor