code: def test_groupby_first_last(data, agg):
      pdf = pd.DataFrame(data)
      gdf = cudf.DataFrame.from_pandas(pdf)
  
      ddf = dd.from_pandas(pdf, npartitions=2)
      gddf = dask_cudf.from_cudf(gdf, npartitions=2)
  
      dd.assert_eq(
          ddf.groupby("a").agg(agg),
          gddf.groupby("a").agg(agg),
      )
  
      dd.assert_eq(
          getattr(ddf.groupby("a"), agg)(),
          getattr(gddf.groupby("a"), agg)(),
      )
  
      dd.assert_eq(
          gdf.groupby("a").agg(agg), gddf.groupby("a").agg(agg)
      )
  
      dd.assert_eq(
          getattr(gdf.groupby("a"), agg)(),
          getattr(gddf.groupby("a"), agg)(),
      )
  
imports: import numpy
  import pandas
  import pytest
  import dask
  from dask import dataframe
  from dask.utils_test import hlg_layer
  import cudf
  import dask_cudf
  from dask_cudf.groupby import OPTIMIZED_AGGS, _aggs_optimized
label_desc: Use image node_id 26 for calling a global function with example usage: test_groupby_first_last(data, agg) without return types