docs: def sort(line):
      """
      change point position  if x1,y0 < x0,y0
      """
      x0, y0, x1, y1 = line
      #     if (x0**2+y0**2)**0.5 < (x1**2+y1**2)**0.5:
      #         return (x1,y1,x0,y0)
      #     return line
      #
      #     if x1 < x0:
      #         return (x1,y1,x0,y0)
      #     return line
  
      turn = False
  
      if abs(x1 - x0) > abs(y1 - y0):
          if x1 < x0:
              turn = True
      elif y1 < y0:
          turn = True
  
      if turn:
          return (x1, y1, x0, y0)
          #  return line[(2,3,0,1)]
      return line