code: def test_frame_mi_access_returns_frame(
      dataframe_with_duplicate_index,
  ):
      # selecting a non_unique from the 2nd level
      df = dataframe_with_duplicate_index
      expected = DataFrame(
          [["d", 4, 4], ["e", 5, 5]],
          index=Index(["B2", "B2"], name="sub"),
          columns=["h1", "h3", "h5"],
      ).T
      result = df["A"]["B2"]
      tm.assert_frame_equal(result, expected)
  
imports: import numpy
  import pytest
  from pandas import DataFrame, Index, MultiIndex, Series
  import pandas._testing
  from pandas.core.indexing import IndexingError
label_desc: Use image node_id 18 for calling a global function with example usage: test_frame_mi_access_returns_frame(dataframe_with_duplicate_index) without return types