code: def test_agg_compat():
      # GH 12334
      df = DataFrame(
          {
              "A": [
                  "foo",
                  "bar",
                  "foo",
                  "bar",
                  "foo",
                  "bar",
                  "foo",
                  "foo",
              ],
              "B": [
                  "one",
                  "one",
                  "two",
                  "two",
                  "two",
                  "two",
                  "one",
                  "two",
              ],
              "C": np.random.default_rng(2).standard_normal(8) + 1.0,
              "D": np.arange(8),
          }
      )
  
      g = df.groupby(["A", "B"])
  
      msg = r"nested renamer is not supported"
      with pytest.raises(SpecificationError, match=msg):
          g["D"].agg({"C": ["sum", "std"]})
  
      with pytest.raises(SpecificationError, match=msg):
          g["D"].agg({"C": "sum", "D": "std"})
  
imports: import datetime
  from functools import partial
  import numpy
  import pytest
  from pandas.errors import SpecificationError
  import pandas
  from pandas import DataFrame, Index, MultiIndex, PeriodIndex, Series, date_range, period_range
  import pandas._testing
  from pandas.io.formats.printing import pprint_thing
label_desc: Use image node_id 9 for calling a global function with example usage: test_agg_compat() without return types