class_docstr: A simple implementation
  of a polynomial class that
  records the details about two polynomials
  that are potentially comprised of multiple
  variables.
class_docstr_tok: ["A","simple","implementation","of","a","polynomial","class","that","records","the","details","about","two","polynomials","that","are","potentially","comprised","of","multiple","variables","."]
docstr: A helper for converting numbers
  to Fraction only when possible.
docstr_tok: ["A","helper","for","converting","numbers","to","Fraction","only","when","possible","."]
code: def _rationalize_if_possible(num):
      """
      A helper for converting numbers
      to Fraction only when possible.
      """
      if isinstance(num, Rational):
          res = Fraction(num, 1)
          return Fraction(res.numerator, res.denominator)
      else:
          return num
  
imports: from fractions import Fraction
  from typing import Dict, Union, Set, Iterable
  from numbers import Rational
  from functools import reduce
label_desc: Use image node_id 2 for calling the Polynomial obj's underlying member method code with example usage: obj._rationalize_if_possible(num) and returns: Fraction, num