from bs4 import BeautifulSoup


def extract_data_by_class(raw_content, elem, class_name, is_all=False):
    """extract html tags by element and class name"""
    parser = "html.parser"
    soup = BeautifulSoup(str(raw_content), parser)
    if is_all:
        return soup.find_all(elem, class_=class_name)
    else:
        return soup.find(elem, class_=class_name)