code: def _check_range(
      val,
      min_val,
      max_val,
      name,
      min_inclusive=True,
      max_inclusive=True,
  ):
      """Check that item is within range.
  
      Parameters
      ----------
      val : int | float
          The value to be checked.
      min_val : int | float
          The minimum value allowed.
      max_val : int | float
          The maximum value allowed.
      name : str
          The name of the value.
      min_inclusive : bool
          Whether ``val`` is allowed to be ``min_val``.
      max_inclusive : bool
          Whether ``val`` is allowed to be ``max_val``.
      """
      below_min = val < min_val if min_inclusive else val <= min_val
      above_max = val > max_val if max_inclusive else val >= max_val
      if below_min or above_max:
          error_str = f"The value of {name} must be between {min_val} "
          if min_inclusive:
              error_str += "inclusive "
          error_str += f"and {max_val}"
          if max_inclusive:
              error_str += "inclusive "
          raise ValueError(error_str)
  
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 27 for calling a global function with example usage: _check_range(val, min_val, max_val, name, min_inclusive, max_inclusive) without return types