<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def teetext(table, source=None, encoding=None, errors='strict', template=None, prologue=None, epilogue=None):
 """ Return a table that writes rows to a text file as they are iterated over. """


    assert template is not None, 'template is required'
    return TeeTextView(table, source=source, encoding=encoding, errors=errors,
                       template=template, prologue=prologue, epilogue=epilogue)