def secs_to_dhms(time_in_secs):
        """Convert seconds to days, hours, minutes, seconds.

        Using days as the largest unit of time.  Blindly using the days in
        `time.gmtime()` will fail if it's more than one month (days > 31).
        """
        days, secs = divmod(int(time_in_secs), SECS_IN_DAY)
        hours, secs = divmod(secs, SECS_IN_HOUR)
        mins, secs = divmod(secs, SECS_IN_MIN)
        return days, hours, mins, secs
Convert seconds to days, hours, minutes, seconds.

        Using days as the largest unit of time.  Blindly using the days in
        `time.gmtime()` will fail if it's more than one month (days > 31).
        
py3status/modules/rate_counter.py