Quick sort implemented in Python