I have basically the same code in python and java (see below). python got TLE, but java was accepted. I propose to relax the python time limit a little bit.

**Python**

```
class Solution:
# @param head, a ListNode
# @return a ListNode
def insertionSortList(self, head):
srt = None
while head:
node = head
head = head.next
node.next = None
srt = self.insertTo(srt, node)
return srt
def insertTo(self, head, node):
node.next = head
head = node
while node.next and node.val > node.next.val:
node.val, node.next.val = node.next.val, node.val
node = node.next
return head
```

**java**

```
public class Solution {
public ListNode insertionSortList(ListNode head) {
ListNode srt = null;
while (head != null) {
ListNode node = head;
head = head.next;
node.next = null;
srt = insertTo(srt, node);
}
return srt;
}
public ListNode insertTo(ListNode head, ListNode node) {
node.next = head;
head = node;
while (node.next != null && node.val > node.next.val) {
node.val = node.val ^ node.next.val;
node.next.val = node.val ^ node.next.val;
node.val = node.val ^ node.next.val;
node = node.next;
}
return head;
}
}
```