<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generate_text_files(in_dir, out_dir, include_header=False):
 """\ Walks through the `in_dir` and generates text versions of the cables in the `out_dir`. """

    for cable in cables_from_source(in_dir):
        out = codecs.open(out_dir + '/' + cable.reference_id + '.txt', 'wb', encoding='utf-8')
        out.write(cable_to_text(cable, include_header))
        out.close()