code: def _check_groupby_optimized(func):
      """
      Decorator for dask-cudf's groupby methods that returns the dask-cudf
      optimized method if the groupby object is supported, otherwise
      reverting to the upstream Dask method
      """
  
      @wraps(func)
      def wrapper(*args, **kwargs):
          gb = args[0]
          if _groupby_optimized(gb):
              return func(*args, **kwargs)
          # note that we use upstream Dask's default kwargs for this call if
          # none are specified; this shouldn't be an issue as those defaults are
          # consistent with dask-cudf
          return getattr(super(type(gb), gb), func.__name__)(
              *args[1:], **kwargs
          )
  
      return wrapper
  
imports: from functools import wraps
  from typing import Set
  import numpy
  import pandas
  from dask.dataframe.core import DataFrame, aca, split_out_on_cols
  from dask.dataframe.groupby import DataFrameGroupBy, SeriesGroupBy
  from dask.utils import funcname
  import cudf
  from cudf.utils.nvtx_annotation import _dask_cudf_nvtx_annotate
  from dask_cudf.sorting import _deprecate_shuffle_kwarg
label_desc: Use image node_id 1 for calling a global function with example usage: _check_groupby_optimized(func) and returns: wrapper, getattr, func