code: def _check_pandas_index_arguments(index, valid):
      """Check pandas index arguments."""
      if index is None:
          return
      if isinstance(index, str):
          index = [index]
      if not isinstance(index, list):
          raise TypeError(
              "index must be `None` or a string or list of strings, got type "
              f"{type(index)}."
          )
      invalid = set(index) - set(valid)
      if invalid:
          plural = ("is not a valid option", "are not valid options")[
              int(len(invalid) > 1)
          ]
          raise ValueError(
              '"{}" {}. Valid index options are `None`, "{}".'.format(
                  '", "'.join(invalid), plural, '", "'.join(valid)
              )
          )
      return index
  
imports: import numbers
  import operator
  import os
  import re
  from builtins import input
  from difflib import get_close_matches
  from importlib import import_module
  from pathlib import Path
  import numpy
  from ..defaults import HEAD_SIZE_DEFAULT, _handle_default
  from ..fixes import _compare_version, _median_complex
  from ._logging import _record_warnings, _verbose_safe_false, logger, verbose, warn
label_desc: Use image node_id 22 for calling a global function with example usage: _check_pandas_index_arguments(index, valid) and returns: index