code: def __new__(
      cls,
      func=None,
      *,
      name: str | None = None,
      # Extra parameter info that is added to NetworkX docstring
      extra_params: dict[str, str] | str | None = None,
      # Applies `nodes_or_number` decorator compatibly across versions (3.3 changed)
      nodes_or_number: list[int] | int | None = None,
      # Metadata (for introspection only)
      version_added: str,  # Required
      is_incomplete: bool = False,  # See self.extra_doc for details if True
      is_different: bool = False,  # See self.extra_doc for details if True
      plc: str
      | set[str]
      | None = None,  # Hidden from user, may be removed someday
  ):
      if func is None:
          return partial(
              networkx_algorithm,
              name=name,
              extra_params=extra_params,
              nodes_or_number=nodes_or_number,
              plc=plc,
              version_added=version_added,
              is_incomplete=is_incomplete,
              is_different=is_different,
          )
      instance = object.__new__(cls)
      if nodes_or_number is not None and nx.__version__[:3] > "3.2":
          func = nx.utils.decorators.nodes_or_number(nodes_or_number)(
              func
          )
      # update_wrapper sets __wrapped__, which will be used for the signature
      update_wrapper(instance, func)
      instance.__defaults__ = func.__defaults__
      instance.__kwdefaults__ = func.__kwdefaults__
      instance.name = func.__name__ if name is None else name
      if extra_params is None:
          pass
      elif isinstance(extra_params, str):
          extra_params = {extra_params: ""}
      elif not isinstance(extra_params, dict):
          raise TypeError(
              f"extra_params must be dict, str, or None; got {type(extra_params)}"
          )
      instance.extra_params = extra_params
      if plc is None or isinstance(plc, set):
          instance._plc_names = plc
      elif isinstance(plc, str):
          instance._plc_names = {plc}
      else:
          raise TypeError(
              f"plc argument must be str, set, or None; got {type(plc)}"
          )
      instance.version_added = version_added
      instance.is_incomplete = is_incomplete
      instance.is_different = is_different
      # The docstring on our function is added to the NetworkX docstring.
      instance.extra_doc = (
          dedent(func.__doc__.lstrip("\n").rstrip())
          if func.__doc__
          else None
      )
      # Copy __doc__ from NetworkX
      if instance.name in _registered_algorithms:
          instance.__doc__ = _registered_algorithms[
              instance.name
          ].__doc__
      instance.can_run = _default_can_run
      setattr(BackendInterface, instance.name, instance)
      # Set methods so they are in __dict__
      instance._can_run = instance._can_run
      if nodes_or_number is not None and nx.__version__[:3] <= "3.2":
          instance = nx.utils.decorators.nodes_or_number(
              nodes_or_number
          )(instance)
      return instance
  
file_path: cugraph/python/nx-cugraph/nx_cugraph/utils/decorators.py
imports: from __future__ import annotations
  from functools import partial, update_wrapper
  from textwrap import dedent
  import networkx
  from networkx.utils.decorators import nodes_or_number, not_implemented_for
  from nx_cugraph.interface import BackendInterface
label_desc: Use image node_id 1 for calling the networkx_algorithm obj's underlying member method code with example usage: obj.__new__(cls, func) and returns: instance, partial