'Parse the POST data and break it into a FILES MultiValueDict and a POST
MultiValueDict.
Returns a tuple containing the POST and FILES dictionary, respectively.'

def parse(self):

    from django.http import QueryDict
    encoding = self._encoding
    handlers = self._upload_handlers
    limited_input_data = LimitBytes(self._input_data, self._content_length)
    for handler in handlers:
        result = handler.handle_raw_input(limited_input_data, self._meta, self._content_length, self._boundary, encoding)
        if (result is not None):
            return (result[0], result[1])
    self._post = QueryDict('', mutable=True)
    self._files = MultiValueDict()
    stream = LazyStream(ChunkIter(limited_input_data, self._chunk_size))
    old_field_name = None
    counters = ([0] * len(handlers))
    try:
        for (item_type, meta_data, field_stream) in Parser(stream, self._boundary):
            if old_field_name:
                self.handle_file_complete(old_field_name, counters)
                old_field_name = None
            try:
                disposition = meta_data['content-disposition'][1]
                field_name = disposition['name'].strip()
            except (KeyError, IndexError, AttributeError):
                continue
            transfer_encoding = meta_data.get('content-transfer-encoding')
            field_name = force_unicode(field_name, encoding, errors='replace')
            if (item_type == FIELD):
                if (transfer_encoding == 'base64'):
                    raw_data = field_stream.read()
                    try:
                        data = str(raw_data).decode('base64')
                    except:
                        data = raw_data
                else:
                    data = field_stream.read()
                self._post.appendlist(field_name, force_unicode(data, encoding, errors='replace'))
            elif (item_type == FILE):
                file_name = disposition.get('filename')
                if (not file_name):
                    continue
                file_name = force_unicode(file_name, encoding, errors='replace')
                file_name = self.IE_sanitize(unescape_entities(file_name))
                content_type = meta_data.get('content-type', ('',))[0].strip()
                try:
                    charset = meta_data.get('content-type', (0, {}))[1].get('charset', None)
                except:
                    charset = None
                try:
                    content_length = int(meta_data.get('content-length')[0])
                except (IndexError, TypeError, ValueError):
                    content_length = None
                counters = ([0] * len(handlers))
                try:
                    for handler in handlers:
                        try:
                            handler.new_file(field_name, file_name, content_type, content_length, charset)
                        except StopFutureHandlers:
                            break
                    for chunk in field_stream:
                        if (transfer_encoding == 'base64'):
                            try:
                                chunk = str(chunk).decode('base64')
                            except Exception as e:
                                raise MultiPartParserError(('Could    not    decode    base64    data:    %r' % e))
                        for (i, handler) in enumerate(handlers):
                            chunk_length = len(chunk)
                            chunk = handler.receive_data_chunk(chunk, counters[i])
                            counters[i] += chunk_length
                            if (chunk is None):
                                break
                except SkipFile as e:
                    exhaust(field_stream)
                else:
                    old_field_name = field_name
            else:
                exhaust(stream)
    except StopUpload as e:
        if (not e.connection_reset):
            exhaust(limited_input_data)
    else:
        exhaust(limited_input_data)
    for handler in handlers:
        retval = handler.upload_complete()
        if retval:
            break
    return (self._post, self._files)
