Calculate waiting time until the next departure time in 'HH:MM' format.

    Return time-delta (as 'MM:SS') from now until next departure time in the 
    future ('HH:MM') given as (year, month, day, hour, minute, seconds). 
    Time-deltas shorter than 60 seconds are reduced to 0.

def wait_time(departure, now=None):
    """
    Calculate waiting time until the next departure time in 'HH:MM' format.

    Return time-delta (as 'MM:SS') from now until next departure time in the 
    future ('HH:MM') given as (year, month, day, hour, minute, seconds). 
    Time-deltas shorter than 60 seconds are reduced to 0.
    """

    now = now or datetime.datetime.now()
    yn, mn, dn = now.year, now.month, now.day
    hour, minute = map(int, departure.split(':'))
    dt = datetime.datetime(yn, mn, dn, hour=hour, minute=minute)
    delta = (dt - now).seconds
    if (dt - now).days < 0:
        delta = 0
    if delta < 3600:
        return '%02d:%02d' % (delta // 60, delta % 60)
    else:
        delta_hh = delta // 3600
        delta_rest = delta - delta_hh * 3600
        return '%02d:%02d:%02d' % (delta_hh, delta_rest // 60, delta_rest % 60)