input: Write a function to identify and fix any bugs in the provided Python code. The function should take a list as an input and return the sum of all elements in the list. If the given code has any issues, correct them for proper functionality.
  def sum_list(list):
      sum_list = 0
      for num in list:
          sum_list += num
      return sum_list
  assert sum_list([1, 2, 3, 4]) == 10
  assert sum_list([0, -1, 1, -1]) == -1
  assert sum_list([]) == 0
  assert sum_list([5, 5, 5, 5]) == 20
  assert sum_list([-1, -2, -3, -4]) == -10
output: def sum_list(input_list):
      total_sum = 0
      for num in input_list:
          total_sum += num
      return total_sum