input: Write a function that takes a list of integers as input and returns the mode (most frequent element) from the list. If the list is empty or has no mode, the function should return None.
  
  Code:
  def find_mode(list):
    if not list:
      return None
    max_count = 0
    mode = None
    count = {}
    for item in list:
      if (item in count):
        count[item] += 1
      else:
        count[item] = 1
      if (count[item] > max_count):
        max_count = count[item]
        mode = item
    return mode
  
  Example assertions:
  assert find_mode([1, 2, 3, 2, 4, 2]) == 2
  assert find_mode([1, 1, 2, 2, 2, 3, 3, 3, 3]) == 3
  assert find_mode([1, 2, 3, 4, 5]) == None
  assert find_mode([]) == None
output: def find_mode(list):
    if not list:
      return None
    max_count = 0
    mode = None
    count = {}
    for item in list:
      if (item in count):
        count[item] += 1
      else:
        count[item] = 1
      if (count[item] > max_count):
        max_count = count[item]
        mode = item
    return mode