parameters: (self, head)
return_statement: return dummy.next
docstring: :type head: ListNode
          :rtype: ListNode
docstring_summary: :type head: ListNode
          :rtype: ListNode
docstring_tokens: : type head : ListNode : rtype : ListNode
function: def swapPairs(self, head):
          """
          :type head: ListNode
          :rtype: ListNode
          """
          dummy = h = ListNode(0)
          step = 1
          tmp = None
          while head:
              if step % 2:
                  tmp = ListNode(head.val)
              else:
                  h.next = ListNode(head.val)
                  h.next.next = tmp
                  h = h.next.next
                  tmp = None
              head = head.next
              step += 1
          if tmp:
              h.next = tmp
          return dummy.next
function_tokens: def swapPairs ( self , head ) : dummy = h = ListNode ( 0 ) step = 1 tmp = None while head : if step % 2 : tmp = ListNode ( head . val ) else : h . next = ListNode ( head . val ) h . next . next = tmp h = h . next . next tmp = None head = head . next step += 1 if tmp : h . next = tmp return dummy . next