input: Write a python function to remove duplicates from a sorted linked list.
  assert remove_duplicates(ListNode.from_list([1, 1, 2, 3, 3])).to_list() == [1, 2, 3]
  assert remove_duplicates(ListNode.from_list([1, 1, 1, 1])).to_list() == [1]
  assert remove_duplicates(ListNode.from_list([1, 2, 3, 4, 5])).to_list() == [1, 2, 3, 4, 5]
  assert remove_duplicates(ListNode.from_list([])) == None
output: class ListNode:
      def __init__(self, val=0, next=None):
          self.val = val
          self.next = next
  
      @classmethod
      def from_list(cls, lst):
          if not lst:
              return None
          head = cls(lst[0])
          current = head
          for value in lst[1:]:
              current.next = cls(value)
              current = current.next
          return head
  
      def to_list(self):
          result = []
          current = self
          while current:
              result.append(current.val)
              current = current.next
          return result
  
  def remove_duplicates(head: ListNode) -> ListNode:
      current = head
      while current and current.next:
          if current.val == current.next.val:
              current.next = current.next.next
          else:
              current = current.next
      return head