code: def totext(table, source=None, encoding=None, errors='strict', template=None,
             prologue=None, epilogue=None):
      
  
      _writetext(table, source=source, mode='wb', encoding=encoding,
                 errors=errors, template=template, prologue=prologue,
                 epilogue=epilogue)
docs: Write the table to a text file. E.g.::
  
          >>> import petl as etl
          >>> table1 = [['foo', 'bar'],
          ...           ['a', 1],
          ...           ['b', 2],
          ...           ['c', 2]]
          >>> prologue = '''{| class="wikitable"
          ... |-
          ... ! foo
          ... ! bar
          ... '''
          >>> template = '''|-
          ... | {foo}
          ... | {bar}
          ... '''
          >>> epilogue = '|}'
          >>> etl.totext(table1, 'example.txt', template=template,
          ... prologue=prologue, epilogue=epilogue)
          >>> # see what we did
          ... print(open('example.txt').read())
          {| class="wikitable"
          |-
          ! foo
          ! bar
          |-
          | a
          | 1
          |-
          | b
          | 2
          |-
          | c
          | 2
          |}
  
      The `template` will be used to format each row via
      `str.format <http://docs.python.org/library/stdtypes.html#str.format>`_.