code: def _validate_integer(name, val, min_val=0):
      
      msg = "'{name:s}' must be an integer >={min_val:d}".format(name=name,
                                                                 min_val=min_val)
  
      if val is not None:
          if is_float(val):
              if int(val) != val:
                  raise ValueError(msg)
              val = int(val)
          elif not (is_integer(val) and val >= min_val):
              raise ValueError(msg)
  
      return val
docs: Checks whether the 'name' parameter for parsing is either
      an integer OR float that can SAFELY be cast to an integer
      without losing accuracy. Raises a ValueError if that is
      not the case.
  
      Parameters
      ----------
      name : string
          Parameter name (used for error reporting)
      val : int or float
          The value to check
      min_val : int
          Minimum allowed value (val < min_val will result in a ValueError)