Parse a ``BeautifulSoup`` element as the given type.

def parse(el, typ):
    """
    Parse a ``BeautifulSoup`` element as the given type.
    """
    if not el:
        return typ()
    txt = text(el)
    if not txt:
        return typ()
    return typ(txt)