@staticmethod
def _duration_to_secs(duration):
    """Convert all duration specifications into seconds."""
    secs = int(duration[:-1])
    if duration[-1] == 's':
        pass
    elif duration[-1] == 'm':
        secs *= 60
    elif duration[-1] == 'h':
        secs *= 60 * 60
    elif duration[-1] == 'd':
        secs *= 60 * 60 * 24
    else:
        raise ValueError('Invalid duration: %r' % duration)
    return secs
