code: def _inplace(df, method, **kwargs):
      """Handle transition: inplace=True (pandas <1.5) → copy=False (>=1.5)."""
      _meth = getattr(df, method)  # used for set_index() and rename()
      if "copy" in signature(_meth).parameters:
          return _meth(**kwargs, copy=False)
      else:
          _meth(**kwargs, inplace=True)
          return df
  
file_path: mne-python/mne/utils/dataframe.py
imports: from inspect import signature
  import numpy
  from ..defaults import _handle_default
  from ._logging import logger, verbose
label_desc: Use image node_id 4 for calling a global function with example usage: _inplace(df, method) and returns: _meth, df