def encodeFormData(arg, value):
    """Encode data as a multipart/form-data
    """
 
    BOUNDARY = '----------BOUNDARY'
   
    l = []
    l.append('--' + BOUNDARY)
    l.append('Content-Disposition: form-data; name="%s"' % arg)
    l.append('')
    l.append(value)
    l.append('--' + BOUNDARY + '--')
    l.append('')

    body = '\r\n'.join(l)
    contentType = 'multipart/form-data; boundary=%s' % BOUNDARY

    return body, contentType
Encode data as a multipart/form-data
    
recipes/Python/500263_twvalidator_MarkValidator_Gateway_Twisted/recipe-500263.py