'Parse C{body} as a multipart MIME response separated by C{boundary}.
Note that this with fail the calling test on certain syntactic
problems.'

def parseMultipartBody(self, body, boundary):

    sep = ('\r\n--' + boundary)
    parts = body.split(sep)
    self.assertEqual('', parts[0])
    self.assertEqual('--\r\n', parts[(-1)])
    parsed_parts = []
    for part in parts[1:(-1)]:
        (before, header1, header2, blank, partBody) = part.split('\r\n', 4)
        headers = ((header1 + '\n') + header2)
        self.assertEqual('', before)
        self.assertEqual('', blank)
        partContentTypeValue = re.search('^content-type:    (.*)$', headers, (re.I | re.M)).group(1)
        (start, end, size) = re.search('^content-range:    bytes    ([0-9]+)-([0-9]+)/([0-9]+)$', headers, (re.I | re.M)).groups()
        parsed_parts.append({'contentType': partContentTypeValue, 'contentRange': (start, end, size), 'body': partBody})
    return parsed_parts
