def get_edges(tree):
    """
    Get edges from url tree. Where url tree is tuple of (url, list of tuples(
    url, list)) etc.

    Example tree:
    (url, [(url1, [...]),
          (url2, [...]).
    ])

    Parameters
    ----------
    tree : tuple
        Tree of urls.

    Returns
    -------
    list
        List of tuples (source page, end page).
    """
    edges = []
    url, elements = tree
    if isinstance(elements, list):
        for element in elements:
            if isinstance(element, str):
                edges.append((url.split("/")[-1], element.split("/")[-1]))
            else:
                edges.append((url.split("/")[-1], element[0].split("/")[-1]))
                edges += get_edges(element)
    return edges