code: def truncate_to_string(num, precision=0):
          
          if precision > 0:
              parts = ('{0:.%df}' % precision).format(Decimal(num)).split('.')
              decimal_digits = parts[1][:precision].rstrip('0')
              decimal_digits = decimal_digits if len(decimal_digits) else '0'
              return parts[0] + '.' + decimal_digits
          return ('%d' % num)
docs: Deprecated, todo: remove references from subclasses