text: import os
  from functools import partial
  from typing import Any
  from typing import Callable
  
  from restpite._constants import RESTPITE_TIMEOUT_CONNECT_ENV
  from restpite._constants import RESTPITE_TIMEOUT_POOL_ENV
  from restpite._constants import RESTPITE_TIMEOUT_READ_ENV
  from restpite._constants import RESTPITE_TIMEOUT_WRITE_ENV
  from restpite._exceptions import EnvironFetchException
  
  
  def convert_env_var(
      var_name: str,
      *,
      cast_type: Callable[
          ...,
          Any,
      ] = float,
      default: Any = None,
  ) -> Any:
      """
      Attempts to read an environment variable value and cast it to a type. For example it permits
      getting numeric value(s) from os.environ
  
      :param var_name: Key to lookup from environment variables.
      :param cast_type: The callable instance to run the env string through if exists.
      :param default: Default value to return if the specified var_name does not exist in os.environ
      """
      try:
          return cast_type(
              os.environ.get(
                  var_name,
                  default,
              )
          )
      except (
          TypeError,
          ValueError,
      ):
          raise EnvironFetchException(f"Unable to cast to: {type(cast_type)}")
  
  
  fetch_connect_timeout = partial(
      convert_env_var,
      var_name=RESTPITE_TIMEOUT_CONNECT_ENV,
      default=10.0,
  )
  fetch_read_timeout = partial(
      convert_env_var,
      var_name=RESTPITE_TIMEOUT_READ_ENV,
      default=10.0,
  )
  fetch_write_timeout = partial(
      convert_env_var,
      var_name=RESTPITE_TIMEOUT_WRITE_ENV,
      default=10.0,
  )
  fetch_pool_timeout = partial(
      convert_env_var,
      var_name=RESTPITE_TIMEOUT_POOL_ENV,
      default=10.0,
  )
  