code: def from_rational(
         cls,
         value,
         to_base,
         precision=None,
         method=RoundingMethods.ROUND_DOWN
      ):
          
          # pylint: disable=too-many-locals
          if to_base < 2:
              raise BasesValueError(to_base, "to_base", "must be at least 2")
  
          if precision is not None and precision < 0:
              raise BasesValueError(precision, "precision", "must be at least 0")
  
          if value == 0:
              non_repeating_part = [] if precision is None else precision * [0]
              return (Radix(0, [], non_repeating_part, [], to_base), 0)
  
          if value < 0:
              sign = -1
          else:
              sign = 1
  
          div_method = method
  
          if sign == -1:
              value = abs(value)
              div_method = cls._reverse_rounding_method(method)
  
          numerator = Nats.convert_from_int(value.numerator, to_base)
          denominator = Nats.convert_from_int(value.denominator, to_base)
  
          (integer_part, non_repeating_part, repeating_part, relation) = \
             NatDivision.division(
                denominator,
                numerator,
                to_base,
                precision,
                div_method
             )
  
          relation = relation * sign
  
          result = Radix(
             sign,
             integer_part,
             non_repeating_part,
             repeating_part,
             to_base
          )
  
          if precision is not None:
              (result, rel) = result.rounded(precision, method)
              relation = relation if rel == 0 else rel
  
          return (result, relation)
docs: Convert rational value to a base.
  
          :param Rational value: the value to convert
          :param int to_base: base of result, must be at least 2
          :param precision: number of digits in total or None
          :type precision: int or NoneType
          :param method: rounding method
          :type method: element of RoundingMethods.METHODS()
          :returns: the conversion result and its relation to actual result
          :rtype: Radix * int
          :raises BasesValueError: if to_base is less than 2
  
          Complexity: Uncalculated.