code: def _sanitize_figure_and_axes(figure, axes):
      """Help for plot_matrix."""
      if axes is not None and figure is not None:
          raise ValueError(
              "Parameters figure and axes cannot be specified together. "
              f"You gave 'figure={figure}, axes={axes}'."
          )
      if figure is not None:
          if isinstance(figure, plt.Figure):
              fig = figure
          else:
              fig = plt.figure(figsize=figure)
          axes = plt.gca()
          own_fig = True
      else:
          if axes is None:
              fig, axes = plt.subplots(1, 1, figsize=(7, 5))
              own_fig = True
          else:
              fig = axes.figure
              own_fig = False
      return fig, axes, own_fig
  
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 3 for calling a global function with example usage: _sanitize_figure_and_axes(figure, axes) and returns: fig,  axes,  own_fig