def get_table_data(soup, text, default=None):
    # type (BeautifulSoup.tag, str) -> str
    """Attempts to retrieve text data from a table based on the header value"""
    if default is None:
        default = ""
    if soup is None:
        return default
    if text is None:
        return default
    head = soup.find("th", text=text)
    if head is None:
        return default
    data = head.findNext("td").text
    return default if data is None or not data else data