from bs4 import BeautifulSoup


def scrape_keywords(contents, el):
    """ Scrape page contents for keywords
        Args:
            contents (BeautifulSoup): contents to scrape
            el (str): element class to look for
        Returns list of tags ([str])
    """
    soup = BeautifulSoup("<div></div>", "html.parser")
    tags = []
    keyword_section = contents.find('div', {'class': el})
    if keyword_section:
        for related in keyword_section.find_all('a'):
            i_tag = soup.new_tag('span')
            i_tag.string = related.text
            i_tag['class'] = "underline"
            tags.append(related.text[:30])
            related.replaceWith(i_tag) # Remove links to other pages
    return tags