input: Write a python function to reverse a linked list.
  assert llist.head.data == 4
  assert llist.head.next.data == 3
  assert llist.head.next.next.data == 2
  assert llist.head.next.next.next.data == 1
output: class Node:
      def __init__(self, data):
          self.data = data
          self.next = None
  
  class LinkedList:
      def __init__(self):
          self.head = None
  
      def reverse(self):
          prev = None
          current = self.head
          while current is not None:
              next_node = current.next
              current.next = prev
              prev = current
              current = next_node
          self.head = prev
  
  # Helper function to create a linked list from a list and return the LinkedList object
  def create_linked_list(arr):
      llist = LinkedList()
      for item in reversed(arr):
          node = Node(item)
          node.next = llist.head
          llist.head = node
      return llist
  
  llist = create_linked_list([1, 2, 3, 4])
  llist.reverse()
  assert llist.head.data == 4
  assert llist.head.next.data == 3
  assert llist.head.next.next.data == 2
  assert llist.head.next.next.next.data == 1