input: Write a python function to reverse a singly linked list.
  assert reverseList(ListNode(1, ListNode(2, ListNode(3, ListNode(4, ListNode(5))))) == ListNode(5, ListNode(4, ListNode(3, ListNode(2, ListNode(1)))))
  assert reverseList(ListNode(1)) == ListNode(1)
  assert reverseList(None) == None
output: class ListNode:
      def __init__(self, val=0, next=None):
          self.val = val
          self.next = next
  
  def reverseList(head: ListNode) -> ListNode:
      prev = None
      current = head
      while current:
          next_node = current.next
          current.next = prev
          prev = current
          current = next_node
      return prev