from pathlib import Path
from bs4 import BeautifulSoup


def _parse_html(file_path: Path) -> list:
    """
    Parse the table from the HTML.

    Keyword arguments:
    file_path -- the Path to the HTML file

    Returns: a list of lists of strings
    """
    # Get the HTML
    html = open(file_path).read()

    # Parse table
    soup = BeautifulSoup(html, "html.parser")
    table_list = soup.find_all("table")

    # We expect the first table to be there with our data
    assert len(table_list) > 0
    table = table_list[1]

    # Parse the cells
    row_list = []
    for row in table.find_all("tr"):
        cell_list = row.find_all(["th", "td"])
        if not cell_list:
            continue
        cell_list = [c.text.strip() for c in cell_list]
        row_list.append(cell_list)

    # Return it
    return row_list