def nth_from_last(lst, n):
    """
    Given a linked list and n, find the nth element from the
    end of the list.
    """
    if n<0:
        raise ValueError("Negative values for n not allowed!")
    curr = lst
    result = lst
    i = 0
    while curr.next is not None:
        curr = curr.next
        if i >= n:
            result=result.next
        i += 1
    return result if i >= n else None