Delete the repeated element from a sorted linked list.
Implement delete_duplicates(head) to remove duplicate nodes in place while retaining the first node for each value. The input is the head of a sorted singly linked list, and the output is the head of the deduplicated list. Test cases represent linked lists as arrays, with conversion to and from ListNode handled by the test harness.
Function signature: def delete_duplicates(head):
def delete_duplicates(head):