def HMS(secs):
    """Return tuple of hours, minutes, and seconds given value in seconds."""
    minutes, seconds = divmod(secs, 60.0)
    hours, minutes = divmod(minutes, 60.0)
    return hours, minutes, seconds