

def timestring(self, maxunits=3):
    'Returns a string representation of this amount of time, like:\n        "2 hours and 30 minutes" or "4 days, 2 hours and 40 minutes"\n\n        :param maxunits = 3\n            The maximum amount of units to use.\n\n            1: "2 hours"\n            4: "4 days, 2 hours, 5 minuts and 46 seconds"\n\n        This method ignores the sign of the amount of time (that rhimes).\n        '
    try:
        assert (maxunits >= 1)
    except:
        raise ValueError('Values < 1 for maxunits are not supported.')
    values = collections.OrderedDict()
    seconds = abs(self.seconds)
    values['year'] = _round((seconds / ((3600 * 24) * 365)))
    values['year'] = (values['year'] if (values['year'] > 0) else 0)
    seconds -= (((values['year'] * 3600) * 24) * 365)
    values['month'] = _round((seconds / ((3600 * 24) * 30)))
    values['month'] = (values['month'] if (values['month'] > 0) else 0)
    seconds -= (((values['month'] * 3600) * 24) * 30)
    values['day'] = _round((seconds / (3600 * 24)))
    values['day'] = (values['day'] if (values['day'] > 0) else 0)
    seconds -= ((values['day'] * 3600) * 24)
    values['hour'] = _round((seconds / 3600))
    values['hour'] = (values['hour'] if (values['hour'] > 0) else 0)
    seconds -= (values['hour'] * 3600)
    values['minute'] = _round((seconds / 60))
    values['minute'] = (values['minute'] if (values['minute'] > 0) else 0)
    values['second'] = _round((seconds - (values['minute'] * 60)))
    for (k, v) in values.items():
        if (v == 0):
            values.pop(k)
        else:
            break
    textsegs = []
    for (k, v) in list(values.items())[:maxunits]:
        if (v > 0):
            textsegs.append(_pluralstr(seconds, v))
    if (len(textsegs) == 0):
        return ''
    if (len(textsegs) == 1):
        return textsegs[0]
    return ((', '.join(textsegs[:(- 1)]) + ' and ') + textsegs[(- 1)])

dataset/ETHPy150Open KoffeinFlummi/Chronyk/chronyk/chronyk.py ChronykDelta.timestring/VarMisuse@428/681 `k`->`seconds`