code: def int_applier(
      value_name: str, min_range: int = -1, max_range: int = -1
  ):
      """
      Returns a function that applies the given value to the given value_name in opts.data.
      """
  
      def validate(value_name: str, value: str):
          value = int(value)
          # validate value
          if not min_range == -1:
              assert (
                  value >= min_range
              ), f"Value {value} for {value_name} must be greater than or equal to {min_range}"
          if not max_range == -1:
              assert (
                  value <= max_range
              ), f"Value {value} for {value_name} must be less than or equal to {max_range}"
  
      def apply_int(p, x, xs):
          validate(value_name, x)
          opts.data[value_name] = int(x)
  
      return apply_int
  
imports: from modules import scripts
  from modules.shared import opts
label_desc: Use image node_id 1 for calling a global function with example usage: int_applier(value_name, min_range, max_range) and returns: apply_int