input: Write a python function to generate all permutations of a list of elements.
  assert list(permutations([1, 2, 3])) == [[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]]
  assert list(permutations(['a', 'b'])) == [['a', 'b'], ['b', 'a']]
  assert list(permutations([1])) == [[1]]
  assert list(permutations([])) == [[]]
output: def permutations(lst):
      if len(lst) == 0:
          return [[]]
      result = []
      for i in range(len(lst)):
          rest = lst[:i] + lst[i+1:]
          for p in permutations(rest):
              result.append([lst[i]] + p)
      return result