def list_to_class(self, html, klass):
    classes = add_css_class(klass, self.get_size_class())
    mapping = [('<ul', '<div class="{classes}"'.format(classes=classes)), ('</ul>', '</div>'), ('<li', '<div class="{form_check_class}"'.format(form_check_class=self.form_check_class)), ('</li>', '</div>')]
    for (k, v) in mapping:
        html = html.replace(k, v)
    soup = BeautifulSoup(html, features='html.parser')
    enclosing_div = soup.find('div', {'class': classes})
    if enclosing_div:
        for label in enclosing_div.find_all('label'):
            label.attrs['class'] = (label.attrs.get('class', []) + ['form-check-label'])
            try:
                label.input.attrs['class'] = (label.input.attrs.get('class', []) + ['form-check-input'])
            except AttributeError:
                pass
    return str(soup)
def list_to_class(self, html, klass):
    classes = add_css_class(klass, self.get_size_class())
    mapping = [('<ul', '<div class="{classes}"'.format(classes=classes)), ('</ul>', '</div>'), ('<li', '<div class="{form_check_class}"'.format(form_check_class=self.form_check_class)), ('</li>', '</div>')]
    for (k, v) in mapping:
        html = html.replace(k, v)
    soup = BeautifulSoup(html, features='html.parser')
    enclosing_div = soup.find('div', {'class': classes})
    if enclosing_div:
        for label in enclosing_div.find_all('label'):
            label.attrs['class'] = (label.attrs.get('class', []) + ['form-check-label'])
            try:
                label.input.attrs['class'] = (label.input.attrs.get('class', []) + ['form-check-input'])
            except AttributeError:
                pass
    return str(soup)