def get_text(tag):
    """
    Get text of tag stripped of leading and trailing whitespace and newlines and with &nbsp replaced with space

    Args:
        tag (Tag): BeautifulSoup tag

    Returns:
        str: Text of tag stripped of leading and trailing whitespace and newlines and with &nbsp replaced with space

    """
    return tag.get_text().strip(' \t\n\r').replace(u'\xa0', u' ')
