code: def _sanitize_reorder(reorder):
      """Help for plot_matrix."""
      VALID_REORDER_ARGS = (
          True,
          False,
          "single",
          "complete",
          "average",
      )
      if reorder not in VALID_REORDER_ARGS:
          param_to_print = []
          for item in VALID_REORDER_ARGS:
              if isinstance(item, str):
                  param_to_print.append(f'"{item}"')
              else:
                  param_to_print.append(str(item))
          raise ValueError(
              "Parameter reorder needs to be one of:"
              f"\n{', '.join(param_to_print)}."
          )
      reorder = "average" if reorder is True else reorder
      return reorder
  
imports: import warnings
  import matplotlib.patches
  import matplotlib.pyplot
  import numpy
  import pandas
  from mpl_toolkits.axes_grid1 import make_axes_locatable
  from scipy.cluster.hierarchy import leaves_list, linkage, optimal_leaf_ordering
  from nilearn.glm.first_level.experimental_paradigm import check_events
  from .._utils import fill_doc
label_desc: Use image node_id 6 for calling a global function with example usage: _sanitize_reorder(reorder) and returns: reorder