input: Write a python function to implement quicksort algorithm.
  assert quicksort([3, 6, 8, 10, 1, 2, 1]) == [1, 1, 2, 3, 6, 8, 10]
  assert quicksort([3, 3, 3]) == [3, 3, 3]
  assert quicksort([1]) == [1]
  assert quicksort([]) == []
  assert quicksort([2, 1, 3, 1, 2, 3, 1]) == [1, 1, 1, 2, 2, 3, 3]
output: def quicksort(arr):
      if len(arr) <= 1:
          return arr
      pivot = arr[len(arr) // 2]
      left = [x for x in arr if x < pivot]
      middle = [x for x in arr if x == pivot]
      right = [x for x in arr if x > pivot]
      return quicksort(left) + middle + quicksort(right)