<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_txt(matrix, version, out, border=None, color='1', background='0'):
 """\ Serializes QR code in a text format. :param matrix: The matrix to serialize. :param int version: The (Micro) QR code version :param out: Filename or a file-like object supporting to write text. :param int border: Integer indicating the size of the quiet zone. If set to ``None`` (default), the recommended border size will be used (``4`` for QR Codes, ``2`` for a Micro QR Codes). :param color: Character to use for the black modules (default: '1') :param background: Character to use for the white modules (default: '0') """

    row_iter = matrix_iter(matrix, version, scale=1, border=border)
    colours = (str(background), str(color))
    with writable(out, 'wt') as f:
        write = f.write
        for row in row_iter:
            write(''.join([colours[i] for i in row]))
            write('\n')