code: def check_limit(value: int) -> int:
      """
      Check the limit does not exceed configured value.
  
      This checks the limit passed to view and raises BadRequest if
      limit exceed user configured value
      """
      max_val = conf.getint(
          "api", "maximum_page_limit"
      )  # user configured max page limit
      fallback = conf.getint("api", "fallback_page_limit")
  
      if value > max_val:
          log.warning(
              "The limit param value %s passed in API exceeds the configured maximum page limit %s",
              value,
              max_val,
          )
          return max_val
      if value == 0:
          return fallback
      if value < 0:
          raise BadRequest("Page limit must be a positive integer")
      return value
  
file_path: airflow/airflow/api_connexion/parameters.py
imports: from __future__ import annotations
  import logging
  from functools import wraps
  from typing import TYPE_CHECKING, Any, Callable, Container, TypeVar, cast
  from pendulum.parsing import ParserError
  from sqlalchemy import text
  from airflow.api_connexion.exceptions import BadRequest
  from airflow.configuration import conf
  from airflow.utils import timezone
label_desc: Use image node_id 3 for calling a global function with example usage: check_limit(value) and returns: value, max_val, fallback