code: def make_channel_first(x: np.array, channel_first: bool = False):
      """
      Reshape batch to channel first.
  
      Parameters
      ----------
      x: np.ndarray
           The input image.
      channel_first: boolean, optional
          Indicates of the image dimensions are channel first, or channel last.
          Inferred from the input shape if None.
  
      Returns
      -------
      np.ndarray
          Image in CxWxH format.
      """
      if channel_first:
          return x
      if len(np.shape(x)) == 2:
          return x
      elif len(np.shape(x)) == 3:
          return np.moveaxis(x, -1, -2)
      elif len(np.shape(x)) == 4:
          return np.moveaxis(x, -1, -3)
  
      else:
          raise ValueError(
              "Only batched 1D and 2D multi-channel input dimensions supported (excluding the channels)."
          )
  
imports: import copy
  import re
  from importlib import util
  from typing import Any, Dict, Optional, Sequence, Tuple, Union, List, TypeVar
  import numpy
  from skimage.segmentation import slic, felzenszwalb
  from quantus.helpers import asserts
  from quantus.helpers.model.model_interface import ModelInterface
label_desc: Use image node_id 8 for calling a global function with example usage: make_channel_first(x, channel_first) and returns: x, x, np, np