def text_or_none(soup, data_type=str):
    """Converts soup text to a data type else return None if soup has no text attribute."""
    try:
        return data_type(soup.text)
    except AttributeError:
        return ''