parameters: (self, head, x)
return_statement: return pre_min.next
docstring: :type head: ListNode
          :type x: int
          :rtype: ListNode
docstring_summary: :type head: ListNode
          :type x: int
          :rtype: ListNode
docstring_tokens: : type head : ListNode : type x : int : rtype : ListNode
function: def partition(self, head, x):
          """
          :type head: ListNode
          :type x: int
          :rtype: ListNode
          """
          if head == None or head.next == None:
              return head
  
          cur = head
          pre_min = cur_min = ListNode(-1)
          pre_max = cur_max = ListNode(-1)
  
          while cur != None:
              if cur.val < x:
                  cur_min.next = cur
                  cur_min = cur_min.next
              else:
                  cur_max.next = cur
                  cur_max = cur_max.next
  
              cur = cur.next
  
          cur_min.next = pre_max.next
          cur_max.next = None
          return pre_min.next
function_tokens: def partition ( self , head , x ) : if head == None or head . next == None : return head cur = head pre_min = cur_min = ListNode ( - 1 ) pre_max = cur_max = ListNode ( - 1 ) while cur != None : if cur . val < x : cur_min . next = cur cur_min = cur_min . next else : cur_max . next = cur cur_max = cur_max . next cur = cur . next cur_min . next = pre_max . next cur_max . next = None return pre_min . next