'Format a duration in days, hours, minutes, seconds.'

@staticmethod
def pretty_duration(hours):

    seconds = int((3600 * hours))
    (days, seconds) = divmod(seconds, 86400)
    (hours, seconds) = divmod(seconds, 3600)
    (minutes, seconds) = divmod(seconds, 60)
    if (days > 0):
        return ('%dd    %dh    %dm' % (days, hours, minutes))
    elif (hours > 0):
        return ('%dh    %dm' % (hours, minutes))
    return ('%dm' % minutes)
