def get_epoch_tle(epoch, tlefile):
    '\n    \n    Find the TLE that is closest to the epoch you want to search.\n    \n    epoch is a datetime object, tlefile is the file you want to search through.\n    \n    '
    (times, line1, line2) = read_tle_file(tlefile)
    from datetime import datetime
    from astropy.time import Time
    if (type(epoch) is Time):
        epoch = epoch.datetime
    mindt = 100.0
    min_ind = 0
    for (ind, t) in enumerate(times):
        dt = abs((epoch - t).days)
        if (dt < mindt):
            min_ind = ind
            mindt = dt
    good_line1 = line1[min_ind]
    good_line2 = line2[min_ind]
    return (mindt, good_line1, good_line2)
Find the TLE that is closest to the epoch you want to search.

epoch is a datetime object, tlefile is the file you want to search through.
def get_epoch_tle(epoch, tlefile):
    '\n    \n    Find the TLE that is closest to the epoch you want to search.\n    \n    epoch is a datetime object, tlefile is the file you want to search through.\n    \n    '
    (times, line1, line2) = read_tle_file(tlefile)
    from datetime import datetime
    from astropy.time import Time
    if (type(epoch) is Time):
        epoch = epoch.datetime
    mindt = 100.0
    min_ind = 0
    for (ind, t) in enumerate(times):
        dt = abs((epoch - t).days)
        if (dt < mindt):
            min_ind = ind
            mindt = dt
    good_line1 = line1[min_ind]
    good_line2 = line2[min_ind]
    return (mindt, good_line1, good_line2)