<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _request(self, method, url, params=None, uploads=None):
 """ Request to server and handle transfer status. """

        c = pycurl.Curl()

        if method == self.POST:
            c.setopt(c.POST, 1)
            if uploads is not None:
                if isinstance(uploads, dict):
                    # handle single upload
                    uploads = [uploads]
                for upload in uploads:
                    params += [(upload['field'],
                               (c.FORM_FILE, upload['path']))]

                c.setopt(c.HTTPPOST, params)
            else:
                # XXX memory leak in pyCurl/7.29.0?
                data = urllib.urlencode(params)
                c.setopt(c.POSTFIELDS, data)

        elif method == self.GET:
            c.setopt(c.HTTPGET, 1)
            if params:
                url += '?%s' % urllib.urlencode(params)

        elif method == self.DELETE:
            c.setopt(pycurl.CUSTOMREQUEST, self.DELETE)

        else:
            raise NotSupportedError(str(method))

        buffer = []

        def _write_cb(data):
            buffer.append(data)

        c.setopt(c.HTTPHEADER, self._hook_header(params))
        c.setopt(pycurl.SSL_VERIFYPEER, 0)
        c.setopt(pycurl.SSL_VERIFYHOST, 0)
        c.setopt(c.URL, url)
        c.setopt(c.NOPROGRESS, 0)
        c.setopt(c.PROGRESSFUNCTION, self._updated_cb)
        c.setopt(c.WRITEFUNCTION, _write_cb)
        c.setopt(c.FOLLOWLOCATION, 1)
        #c.setopt(c.VERBOSE, True)

        try:
            self.emit('started')
            c.perform()
        except pycurl.error, e:
            raise TransferError(str(e))
        else:
            code = c.getinfo(c.HTTP_CODE)
            if not 200 <= code < 300:
                raise ResponseError(code)
        finally:
            c.close()

        return ''.join(buffer)