code: def hypsum(expr: "Expr", n: "Symbol", start: int, prec: int) -> mpf:
      """
      Sum a rapidly convergent infinite hypergeometric series with
      given general term, e.g. e = hypsum(1/factorial(n), n). The
      quotient between successive terms must be a quotient of integer
      polynomials.
      """
      from .numbers import Float, equal_valued
      from sympy.simplify.simplify import hypersimp
  
      if prec == float("inf"):
          raise NotImplementedError("does not support inf prec")
  
      if start:
          expr = expr.subs(n, n + start)
      hs = hypersimp(expr, n)
      if hs is None:
          raise NotImplementedError(
              "a hypergeometric series is required"
          )
      num, den = hs.as_numer_denom()
  
      func1 = lambdify(n, num)
      func2 = lambdify(n, den)
  
      h, g, p = check_convergence(num, den, n)
  
      if h < 0:
          raise ValueError("Sum diverges like (n!)^%i" % (-h))
  
      term = expr.subs(n, 0)
      if not term.is_Rational:
          raise NotImplementedError(
              "Non rational term functionality is not implemented."
          )
  
      # Direct summation if geometric or faster
      if h > 0 or (h == 0 and abs(g) > 1):
          term = (MPZ(term.p) << prec) // term.q
          s = term
          k = 1
          while abs(term) > 5:
              term *= MPZ(func1(k - 1))
              term //= MPZ(func2(k - 1))
              s += term
              k += 1
          return from_man_exp(s, -prec)
      else:
          alt = g < 0
          if abs(g) < 1:
              raise ValueError("Sum diverges like (%i)^n" % abs(1 / g))
          if p < 1 or (equal_valued(p, 1) and not alt):
              raise ValueError("Sum diverges like n^%i" % (-p))
          # We have polynomial convergence: use Richardson extrapolation
          vold = None
          ndig = prec_to_dps(prec)
          while True:
              # Need to use at least quad precision because a lot of cancellation
              # might occur in the extrapolation process; we check the answer to
              # make sure that the desired precision has been reached, too.
              prec2 = 4 * prec
              term0 = (MPZ(term.p) << prec2) // term.q
  
              def summand(k, _term=[term0]):
                  if k:
                      k = int(k)
                      _term[0] *= MPZ(func1(k - 1))
                      _term[0] //= MPZ(func2(k - 1))
                  return make_mpf(from_man_exp(_term[0], -prec2))
  
              with workprec(prec):
                  v = nsum(
                      summand, [0, mpmath_inf], method="richardson"
                  )
              vf = Float(v, ndig)
              if vold is not None and vold == vf:
                  break
              prec += prec  # double precision each time
              vold = vf
  
          return v._mpf_
  
imports: from __future__ import annotations
  from typing import Tuple, Optional, Union, Callable, List, Dict, Type, TYPE_CHECKING, Any, overload
  import math
  import mpmath.libmp
  from mpmath import make_mpc, make_mpf, mp, mpc, mpf, nsum, quadts, quadosc, workprec
  from mpmath import inf
  from mpmath.libmp import from_int, from_man_exp, from_rational, fhalf, fnan, finf, fninf, fnone, fone, fzero, mpf_abs, mpf_add, mpf_atan, mpf_atan2, mpf_cmp, mpf_cos, mpf_e, mpf_exp, mpf_log, mpf_lt, mpf_mul, mpf_neg, mpf_pi, mpf_pow, mpf_pow_int, mpf_shift, mpf_sin, mpf_sqrt, normalize, round_nearest, to_int, to_str
  from mpmath.libmp import bitcount
  from mpmath.libmp.backend import MPZ
  from mpmath.libmp.libmpc import _infs_nan
  from mpmath.libmp.libmpf import dps_to_prec, prec_to_dps
  from .sympify import sympify
  from .singleton import S
  from sympy.external.gmpy import SYMPY_INTS
  from sympy.utilities.iterables import is_sequence
  from sympy.utilities.lambdify import lambdify
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 38 for calling a global function with example usage: hypsum(expr, n, start, prec) and returns: from_man_exp, v, make_mpf