code: def test_get_level_number_out_of_bounds(
      multiindex_dataframe_random_data,
  ):
      frame = multiindex_dataframe_random_data
  
      with pytest.raises(IndexError, match="Too many levels"):
          frame.index._get_level_number(2)
      with pytest.raises(IndexError, match="not a valid level number"):
          frame.index._get_level_number(-3)
  
imports: import numpy
  import pytest
  from pandas.compat import PY311
  from pandas.core.dtypes.dtypes import DatetimeTZDtype
  import pandas
  from pandas import CategoricalIndex, MultiIndex
  import pandas._testing
label_desc: Use image node_id 6 for calling a global function with example usage: test_get_level_number_out_of_bounds(multiindex_dataframe_random_data) without return types