def attach(name, contents = None):
def do_attach(func):<EOL><INDENT>if hasattr(func, '<STR_LIT>'):<EOL><INDENT>func.__attachments__.append((name, contents))<EOL><DEDENT>else:<EOL><INDENT>func.__attachments__ = [(name, contents)]<EOL><DEDENT>return func<EOL><DEDENT>return do_attach<EOL>
attaches a file to the payload to be uploaded.

If contents is omitted the file is read from disk.
If name is a tuple it specifies the on-disk filename and the destination filename.