from bs4 import BeautifulSoup


def replace_links(name):
    """replace the links with a #

    this function will receive a filename, will open it, parse the data and
    then will try to find all the links from the file. we will remove the
    link `url` with a `#` and return the data alongside the name.
    we will check if the link's `href` is starting with  `http`. this will
    match both `http` and `https` links that are going out of our local
    html boundary. there may be other links that aren't starting with `html`
    but we are not worried about that, just yet.
    
    :arg name: str, path/name of a file to be opened and parsed
    :returns: tuple, name of the file and the content of that file
    """
    if not name.endswith("html"):
        raise ValueError("the name should be the full path of a html file")
    with open(name, "r") as tmp_file:
        html = tmp_file.read()
    soup = BeautifulSoup(html, "html.parser")
    for link in soup.find_all("a"):
        href = link.get("href")
        if href.startswith("http"):
            link['href'] = "#"
    return name, str(soup)