from bs4 import BeautifulSoup
import re


def get_links(html_page, base_url):
    """gets all links from html

    Parameters
    ------
    html_page (str): document html
    base_url (str): the original URL supplied

    Returns
    ------
    list: list of all the links in the html document
        these could be files or sub-directories
    """
    # "lxml" supposed to be faster than "html.parser
    soup = BeautifulSoup(html_page, "html.parser")
    regex = ".|(/$)"
    links = [f"{link.get('href')}"
             for link
             in soup.findAll('a', attrs={'href': re.compile(regex)})]

    return links