def inlines(value, return_list=False):
    try:
        from BeautifulSoup import BeautifulSoup
    except __HOLE__:
        from beautifulsoup import BeautifulSoup

    content = BeautifulSoup(value, selfClosingTags=['inline','img','br','input','meta','link','hr'])
    inline_list = []

    if return_list:
        for inline in content.findAll(is_inline):
            rendered_inline = render_inline(inline)
            inline_list.append(rendered_inline['context'])
        return inline_list
    else:
        for inline in content.findAll(is_inline):
            rendered_inline = render_inline(inline)
            if rendered_inline:
                inline.replaceWith(BeautifulSoup(render_to_string(rendered_inline['template'], rendered_inline['context'])))
            else:
                inline.replaceWith('')
        return mark_safe(content)
dataset/ETHPy150Open issackelly/django-improved-inlines/improved_inlines/parser.py/inlines