from bs4 import BeautifulSoup
import six


def _convert_toc(wiki_html):
    """Convert Table of Contents from mediawiki to markdown"""
    soup = BeautifulSoup(wiki_html, 'html.parser')
    for toc_div in soup.findAll('div', id='toc'):
        toc_div.replaceWith('[TOC]')
    return six.text_type(soup)