Implemented a function to get nodes from the list