def check_links(filename, links, bad_links, links_tested):
    # Checks all links given, and adds bad links to bad_links.
    print("links to check: ", links)
    for link in links:
        print("Checking link: %s..." % link)

        # Only check links that haven't already been checked:
        if links_tested in link:
            continue
        
        # External links don't need our root.
        if 'http' in link:
            url = link
        else:
            url = root + link
        print('checking url: ', url)
        r = requests.get(url)
        print('Status code: ', r.status_code)
        if r.status_code != 200:
            bad_links[filename + '---' + link] = r.status_code
        else:
            links_tested.append(link)

# Location of html files
#  Assume all files in this directory, no nesting
dataset/ETHPy150Open ehmatthes/intro_programming/tests/test_links.py/check_links/swapped operands of `in`