code: def continued_fraction_iterator(x):
      """
      Return continued fraction expansion of x as iterator.
  
      Examples
      ========
  
      >>> from sympy import Rational, pi
      >>> from sympy.ntheory.continued_fraction import continued_fraction_iterator
  
      >>> list(continued_fraction_iterator(Rational(3, 8)))
      [0, 2, 1, 2]
      >>> list(continued_fraction_iterator(Rational(-3, 8)))
      [-1, 1, 1, 1, 2]
  
      >>> for i, v in enumerate(continued_fraction_iterator(pi)):
      ...     if i > 7:
      ...         break
      ...     print(v)
      3
      7
      15
      1
      292
      1
      1
      1
  
      References
      ==========
  
      .. [1] https://en.wikipedia.org/wiki/Continued_fraction
  
      """
      from sympy.functions import floor
  
      while True:
          i = floor(x)
          yield i
          x -= i
          if not x:
              break
          x = 1 / x
  
file_path: sympy/sympy/ntheory/continued_fraction.py
imports: from __future__ import annotations
  import itertools
  from sympy.core.exprtools import factor_terms
  from sympy.core.numbers import Integer, Rational
  from sympy.core.singleton import S
  from sympy.core.symbol import Dummy
  from sympy.core.sympify import _sympify
  from sympy.utilities.misc import as_int
label_desc: Use image node_id 4 for calling a global function with example usage: continued_fraction_iterator(x) without return types