<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_code(self, url, html):
 """ Parse the code details and TOC from the given HTML content :type url: str :param url: source URL of the page :type html: unicode :param html: Content of the HTML :return: the code """

        soup = BeautifulSoup(html, 'html5lib', from_encoding='utf-8')

        # -- main text
        div = (soup
               .find('div', id='content_false')
               .find('div', attrs={'class': 'data'}))

        code = Code(self.id_code,
                    date_pub=self.date_pub,
                    url_code=cleanup_url(url))

        # -- Code title/subtitle
        div_title = div.find('div', id='titreTexte')
        span_subtitle = div_title.find('span',
                                       attrs={'class': 'sousTitreTexte'})
        if span_subtitle:
            code.title = div_title.text.replace(span_subtitle.text, '')
            code.subtitle = span_subtitle.text.strip()
            regex = r'Version consolidée au (\d{1,2}(?:er)?\s+[^\s]+\s+\d{4})'
            m = re.search(regex, code.subtitle)
            if m:
                code.date_pub = parse_date(m.group(1))

        code.title = code.title.strip()

        # -- TOC
        code.children = [self.parse_code_ul(url, child)
                         for child in div.find_all('ul', recursive=False)]

        return code