input: Write a python function to flatten a nested list.
  assert flatten_list([1, [2, [3, 4], 5], 6]) == [1, 2, 3, 4, 5, 6]
  assert flatten_list([[1, 2, [3]], 4, [5, [6, [7, 8]]]]) == [1, 2, 3, 4, 5, 6, 7, 8]
  assert flatten_list([[[[1]]], [[2]], 3, [4, [5, [6]]]]) == [1, 2, 3, 4, 5, 6]
output: def flatten_list(nested_list):
      result = []
      
      def flatten(sublist):
          for item in sublist:
              if isinstance(item, list):
                  flatten(item)
              else:
                  result.append(item)
      
      flatten(nested_list)
      return result