def has_loops(path):
    """Returns True if this path has a loop in it, i.e. if it
    visits a node more than once. Returns False otherwise."""
    for node in path:
        count = 0
        for n in path:
            if node == n:
                count +=1
        if count > 1:
            return True
    return False