def relative_time(d, other=None, ndigits=0):
 (drt, unit) = decimal_relative_time(d, other, ndigits, cardinalize=True)
 phrase = 'ago'
 if (drt < 0):
  phrase = 'from now'
 return ('%g %s %s' % (abs(drt), unit, phrase))

def relative_time ( d , other = None , ndigits = 0 ) : ( drt , unit ) = decimal_relative_time ( d , other , ndigits , cardinalize = True ) phrase = 'ago' if ( drt < 0 ) : phrase = 'from now' return ( '%g %s %s' % ( abs ( drt ) , unit , phrase ) )
get a string representation of the difference between two :class:~datetime .