work out signal loss times for a log file

def sigloss(logfile):
    '''work out signal loss times for a log file'''
    print("Processing log %s" % filename)
    mlog = mavutil.mavlink_connection(filename,
                                      planner_format=args.planner,
                                      notimestamps=args.notimestamps,
                                      robust_parsing=args.robust)

    last_t = 0

    types = args.types
    if types is not None:
        types = types.split(',')

    while True:
        m = mlog.recv_match(condition=args.condition)
        if m is None:
            return
        if types is not None and m.get_type() not in types:
            continue
        if args.notimestamps:
            if not 'usec' in m._fieldnames:
                continue
            t = m.usec / 1.0e6
        else:
            t = m._timestamp
        if last_t != 0:
            if t - last_t > args.deltat:
                print("Sig lost for %.1fs at %s" % (t-last_t, time.asctime(time.localtime(t))))
        last_t = t