def get_content_before_tag(tag, include_tag=False) ->str:
    """
    Get HTML-code before `tag` and return it as string.
    Tag's not included by default.
    """
    result = ''
    bs = tag.previous_sibling
    while bs is not None:
        result = str(bs) + result
        bs = bs.previous_sibling
    return str(tag) + result if include_tag else result
