input: Write a function to identify and fix potential errors in the given Python function that attempts to modify a list while iterating over it. Update the function so that it creates a copy of the list before iterating.
  
  def expand_list(list):
      list_copy = list[:]   # make a copy of the list
      for item in list_copy:
          list *= 2
  
  assert expand_list([1, 2, 3])==[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3]
  assert expand_list([4, 5])==[4, 5, 4, 5, 4, 5, 4, 5]
  assert expand_list([])==[]
  assert expand_list([1])==[1, 1]
  assert expand_list([2, 2])==[2, 2, 2, 2]
output: def expand_list(list):
      list_copy = list[:]
      for item in list_copy:
          list *= 2