def parseMultipartBody(self, body, boundary):
        """
        Parse C{body} as a multipart MIME response separated by C{boundary}.

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

        Parse C{body} as a multipart MIME response separated by C{boundary}.

        Note that this with fail the calling test on certain syntactic
        problems.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_static.py