import html


def formatTitle(title):
    """
    The formatTitle function formats titles extracted from the scraped HTML code.
    """
    title = html.unescape(title)
    if(len(title) > 40):
        return title[:40] + "..."
    return title