code: def validate_integer(
      name, val: int | float | None, min_val: int = 0
  ) -> int | None:
      """
      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 : str
          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)
      """
      if val is None:
          return val
  
      msg = f"'{name:s}' must be an integer >={min_val:d}"
      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 int(val)
  
imports: from __future__ import annotations
  from collections import abc
  import csv
  import sys
  from textwrap import fill
  from types import TracebackType
  from typing import IO, Any, Callable, Hashable, Literal, NamedTuple, Sequence, overload
  import warnings
  import numpy
  from pandas._libs import lib
  from pandas._libs.parsers import STR_NA_VALUES
  from pandas._typing import CompressionOptions, CSVEngine, DtypeArg, DtypeBackend, FilePath, IndexLabel, ReadCsvBuffer, StorageOptions
  from pandas.errors import AbstractMethodError, ParserWarning
  from pandas.util._decorators import Appender
  from pandas.util._exceptions import find_stack_level
  from pandas.util._validators import check_dtype_backend
  from pandas.core.dtypes.common import is_file_like, is_float, is_integer, is_list_like
  from pandas.core.frame import DataFrame
  from pandas.core.indexes.api import RangeIndex
  from pandas.core.shared_docs import _shared_docs
  from pandas.io.common import IOHandles, get_handle, stringify_path, validate_header_arg
  from pandas.io.parsers.arrow_parser_wrapper import ArrowParserWrapper
  from pandas.io.parsers.base_parser import ParserBase, is_index_col, parser_defaults
  from pandas.io.parsers.c_parser_wrapper import CParserWrapper
  from pandas.io.parsers.python_parser import FixedWidthFieldParser, PythonParser
label_desc: Use image node_id 4 for calling a global function with example usage: validate_integer(name, val, min_val) and returns: int, val