def METHOD_NAME(self, these_vars, files, boundary = None, buf = None):
    if boundary is None:
        boundary = _make_boundary(os.getuid + os.getpid())
    if buf is None:
        buf = StringIO()
    for(key, value) in these_vars:
        buf.write('--%s\r\n' % boundary)
        buf.write('Content-Disposition: form-data; name="%s"' % key)
        buf.write('\r\n\r\n' + value + '\r\n')
    for(key, fd) in files:
        file_size = os.fstat(fd.fileno())[stat.ST_SIZE]
        filename = fd.name.split('/')[-1]
        contenttype = mimetypes.guess_type(filename)[0] or 'application/octet-stream'
        buf.write('--%s\r\n' % boundary)
        buf.write('Content-Disposition: form-data; name="%s"; filename="%s"\r\n' % (key, filename))
        buf.write('Content-Type: %s\r\n' % contenttype)
        # buffer += 'Content-Length: %s\r\n' % file_size
        fd.seek(0)
        buf.write('\r\n' + fd.read() + '\r\n')
    buf.write('--' + boundary + '--\r\n\r\n')
    buf = buf.getvalue()
    return boundary, buf