input: Write a function to generate a Python program that takes two lists as input and returns a new list containing only the common elements. If no common elements are found, return an empty list. Assure that the function works correctly by using the provided test cases.
  
  def common_elements(list1, list2): 
      common_list=[]
      for element in list1: 
          if element in list2: 
              common_list.append(element) 
      return common_list
    
  assert common_elements([1, 2, 3, 4, 8], [2, 6, 8, 10]) == [2, 8]
  assert common_elements([10, 20, 30], [5, 30, 15]) == [30]
  assert common_elements([], [1, 2, 3]) == []
  assert common_elements([1, 2, 3], []) == []
  assert common_elements([1, 1, 1], [1, 1]) == [1, 1]
output: def common_elements(list1, list2): 
      common_list=[]
      for element in list1: 
          if element in list2: 
              common_list.append(element) 
      return common_list