def read_tle_file(tlefile, **kwargs):
    '\n    \n    Read in a TLE file and return the TLE that is closest to the date you want to\n    propagate the orbit to.\n    '
    times = []
    line1 = []
    line2 = []
    from os import path
    from datetime import datetime
    try:
        f = open(tlefile, 'r')
    except FileNotFoundError:
        print(('Unable to open: ' + tlefile))
    ln = 0
    for line in f:
        if (ln == 0):
            year = int(line[18:20])
            day = int(line[20:23])
            times.extend([datetime.strptime('{}:{}'.format(year, day), '%y:%j')])
            line1.extend([line.strip()])
            ln = 1
        else:
            ln = 0
            line2.extend([line.strip()])
    f.close()
    return (times, line1, line2)
Read in a TLE file and return the TLE that is closest to the date you want to
propagate the orbit to.
def read_tle_file(tlefile, **kwargs):
    '\n    \n    Read in a TLE file and return the TLE that is closest to the date you want to\n    propagate the orbit to.\n    '
    times = []
    line1 = []
    line2 = []
    from os import path
    from datetime import datetime
    try:
        f = open(tlefile, 'r')
    except FileNotFoundError:
        print(('Unable to open: ' + tlefile))
    ln = 0
    for line in f:
        if (ln == 0):
            year = int(line[18:20])
            day = int(line[20:23])
            times.extend([datetime.strptime('{}:{}'.format(year, day), '%y:%j')])
            line1.extend([line.strip()])
            ln = 1
        else:
            ln = 0
            line2.extend([line.strip()])
    f.close()
    return (times, line1, line2)