Return the text of a ``BeautifulSoup`` element, assuming it's a course code
    (it strips any square-brackets-surrounded number at its end).

def coursecode(el):
    """
    Return the text of a ``BeautifulSoup`` element, assuming it's a course code
    (it strips any square-brackets-surrounded number at its end).
    """
    txt = text(el)
    return re.sub(r"\s*\[\d+\]$", "", txt, re.UNICODE)