def approximate_age(self, from_stamp, to_stamp=None, precision=2):
        if to_stamp is None:
            to_stamp = time.time()
        rem = to_stamp - from_stamp

        def divide(rem, mod):
            return rem % mod, int(rem // mod)

        def subtract(rem, div):
            n = int(rem // div)
            return n,  rem - n * div

        seconds, rem = divide(rem, 60)
        minutes, rem = divide(rem, 60)
        hours,  days = divide(rem, 24)
        years,  days = subtract(days, 365)
        months, days = subtract(days, 30)
        weeks,  days = subtract(days, 7)

        magnitudes = []
        first = None
        values = locals()
        for i, magnitude in enumerate(("years", "months", "weeks", "days", "hours", "minutes", "seconds")):
            v = int(values[magnitude])
            if v == 0:
                continue
            s = "%s %s" % (v, magnitude)
            if v == 1:  # strip plural s
                s = s[:-1]
            # Handle precision limit
            if first is None:
                first = i
            elif first + precision <= i:
                break
            magnitudes.append(s)

        return ", ".join(magnitudes)
Calculate the relative time from given timestamp to another given (epoch) or now.
dataset/ETHPy150Open FichteFoll/FileHistory/file_history.py/OpenRecentlyClosedFileCommand.approximate_age