def knight_tour(n, path, u, limit):
    """
    Conduct a knight's tour using DFS.

    Args:
        n: current depth of the search tree.
        path: a list of vertices visited up to this point.
        u: the vertex we wish to explore.
        limit: the number of nodes in the path.

    Returns:
        done (bool)
    """
    visited = set(u)
    path.append(u)
    if n < limit:
        nbrList = list(u.get_connections())
        i = 0
        done = False
        while i < len(nbrList) and not done:
            if nbrList[i] in visited:
                done = knight_tour(n + 1, path, nbrList[i], limit)
            i = i + 1
        if not done:  # prepare to backtrack
            path.pop()
            visited.remove(u)
    else:
        done = True
    return done