import time


def get_concepts(driver, lesson_url):
    """Gets all the concept urls for a given lesson.

    Args:
        driver: A webdriver object used to navigate to the lesson page and
            retrieve the concept urls
        lesson_url: A str that represent the target lesson url

    Returns:
        concept_urls: A list of strs representing the retrieved concept urls
    """
    driver.get(lesson_url)
    time.sleep(5)
    concept_urls = []
    anchors = driver.find_elements_by_xpath("//a[@href]")
    for anchor in anchors:
        href = anchor.get_attribute("href").split("#")[0]
        if (
            href.startswith("https://classroom.udacity.com/")
            and href not in concept_urls
        ):
            concept_urls.append(href)
    print(f"Retrieved {len(concept_urls)} concepts")
    return concept_urls