code: def test_rank_multiindex():
      # GH27721
      df = concat(
          {
              "a": DataFrame({"col1": [3, 4], "col2": [1, 2]}),
              "b": DataFrame({"col3": [5, 6], "col4": [7, 8]}),
          },
          axis=1,
      )
  
      msg = "DataFrame.groupby with axis=1 is deprecated"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          gb = df.groupby(level=0, axis=1)
      msg = "DataFrameGroupBy.rank with axis=1 is deprecated"
      with tm.assert_produces_warning(FutureWarning, match=msg):
          result = gb.rank(axis=1)
  
      expected = concat(
          [
              df["a"].rank(axis=1),
              df["b"].rank(axis=1),
          ],
          axis=1,
          keys=["a", "b"],
      )
      tm.assert_frame_equal(result, expected)
  
imports: from datetime import datetime
  import numpy
  import pytest
  import pandas
  from pandas import DataFrame, NaT, Series, concat
  import pandas._testing
label_desc: Use image node_id 14 for calling a global function with example usage: test_rank_multiindex() without return types