input: Write a function to determine the most common fruit name from a list containing fruit names. If the most common fruit is not unique (i.e., there is a tie), the function should return the first one encountered. If the list is empty, the function should return None.
  assert most_common_fruit(['Apple', 'Orange', 'Apple', 'Pineapple', 'Grape', 'Apple'])=='Apple'
  assert most_common_fruit(['Banana', 'Apple', 'Banana', 'Apple', 'Grape', 'Grape'])=='Banana'
  assert most_common_fruit(['Apple', 'Apple', 'Apple', 'Apple'])=='Apple'
  assert most_common_fruit([])==None
output: def most_common_fruit(fruits):
      if not fruits:
          return None
      fruit_count = {}
      for fruit in fruits:
          if fruit in fruit_count:
              fruit_count[fruit] += 1
          else:
              fruit_count[fruit] = 1
      return max(fruits, key=lambda x: (fruit_count[x], -fruits.index(x)))