<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def main():
 """ Discards all pairs of sentences which can't be decoded by latin-1 encoder. It aims to filter out sentences with rare unicode glyphs and pairs which are most likely not valid English-German sentences. Examples of discarded sentences: Для их осуществления нам, прежде всего, необходимо преодолеть возражения рыночных фундаменталистов, которые хотят ликвидировать или уменьшить роль МВФ. practised as a scientist in various medical departments of the ⇗Medical University of Hanover , the ⇗University of Ulm , and the ⇗RWTH Aachen (rheumatology, pharmacology, physiology, pathology, microbiology, immunology and electron-microscopy). The same shift】 and press 【】 【alt out with a smaller diameter circle. Brought to you by ABMSUBS ♥leira(Coordinator/Translator) Some examples: &0u - ☺ &0U - ☻ &tel - ☏ &PI - ¶ &SU - ☼ &cH- - ♥ &M2=♫ &sn - ﺵ SGML maps SGML to unicode. """

    args = parse_args()

    c = Counter()
    skipped = 0
    valid = 0
    data1 = []
    data2 = []

    with open(args.file1) as f1, open(args.file2) as f2:
        for idx, lines in enumerate(zip(f1, f2)):
            line1, line2 = lines
            if idx % 100000 == 1:
                print('Processed {} lines'.format(idx))
            try:
                line1.encode('latin1')
                line2.encode('latin1')
            except UnicodeEncodeError:
                skipped += 1
            else:
                data1.append(line1)
                data2.append(line2)
                valid += 1
                c.update(line1)

    ratio = valid / (skipped + valid)
    print('Skipped: {}, Valid: {}, Valid ratio {}'.format(skipped, valid, ratio))
    print('Character frequency:', c)

    save_output(args.file1, data1)
    save_output(args.file2, data2)