docs: def relative_time(d, other=None, ndigits=0):
      """Get a string representation of the difference between two
      :class:`~datetime.datetime` objects or one
      :class:`~datetime.datetime` and the current time. Handles past and
      future times.
  
      Args:
          d (datetime): The first datetime object.
          other (datetime): An optional second datetime object. If
              unset, defaults to the current time as determined
              :meth:`datetime.utcnow`.
          ndigits (int): The number of decimal digits to round to,
              defaults to ``0``.
      Returns:
          A short English-language string.
  
      >>> now = datetime.utcnow()
      >>> relative_time(now, ndigits=1)
      '0 seconds ago'
      >>> relative_time(now - timedelta(days=1, seconds=36000), ndigits=1)
      '1.4 days ago'
      >>> relative_time(now + timedelta(days=7), now, ndigits=1)
      '1 week from now'
  
      """
      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)