code: def require_integer_in_range(
      x, variable_name, min_val=-np.inf, max_val=np.inf
  ):
      """
      A function to verify that a variable is an integer in a specified closed range.
      Args:
          x: the variable to check
          variable_name (str): the name of the variable to print out in error messages
          min_val: the minimum value that `x` can attain
          min_val: the maximum value that `x` can attain
      """
  
      if not isinstance(x, int):
          raise TypeError(
              f"{variable_name}: expected int, found {type(x).__name__}"
          )
  
      if x < min_val or x > max_val:
          if min_val == -np.inf:
              region = f"<= {max_val}"
          elif max_val == np.inf:
              region = f">= {min_val}"
          else:
              region = f"in the range [{min_val}, {max_val}]"
  
          raise ValueError(
              f"{variable_name}: expected integer {region}, found {x}"
          )
  
imports: import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: require_integer_in_range(x, variable_name, min_val, max_val) without return types