code: def test_nth_multi_index_as_expected():
      # PR 9090, related to issue 8979
      # test nth on MultiIndex
      three_group = DataFrame(
          {
              "A": [
                  "foo",
                  "foo",
                  "foo",
                  "foo",
                  "bar",
                  "bar",
                  "bar",
                  "bar",
                  "foo",
                  "foo",
                  "foo",
              ],
              "B": [
                  "one",
                  "one",
                  "one",
                  "two",
                  "one",
                  "one",
                  "one",
                  "two",
                  "two",
                  "two",
                  "one",
              ],
              "C": [
                  "dull",
                  "dull",
                  "shiny",
                  "dull",
                  "dull",
                  "shiny",
                  "shiny",
                  "dull",
                  "shiny",
                  "shiny",
                  "shiny",
              ],
          }
      )
      grouped = three_group.groupby(["A", "B"])
      result = grouped.nth(0)
      expected = three_group.iloc[[0, 3, 4, 7]]
      tm.assert_frame_equal(result, expected)
  
imports: import numpy
  import pytest
  import pandas
  from pandas import DataFrame, Index, MultiIndex, Series, Timestamp, isna
  import pandas._testing
label_desc: Use image node_id 20 for calling a global function with example usage: test_nth_multi_index_as_expected() without return types