def encode(input, output, encoding):
if encoding == '<STR_LIT>':<EOL><INDENT>import base64<EOL>return base64.encode(input, output)<EOL><DEDENT>if encoding == '<STR_LIT>':<EOL><INDENT>import quopri<EOL>return quopri.encode(input, output, <NUM_LIT:0>)<EOL><DEDENT>if encoding in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>import uu<EOL>return uu.encode(input, output)<EOL><DEDENT>if encoding in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>return output.write(input.read())<EOL><DEDENT>if encoding in encodetab:<EOL><INDENT>pipethrough(input, encodetab[encoding], output)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' % encoding)<EOL><DEDENT>
Encode common content-transfer-encodings (base64, quopri, uuencode).