input: Write a function to find the mode of the given set of values. The mode is the most frequently occurring value in the list. If there are multiple values that appear with the same highest frequency, return any one of them.
  
  
  def find_mode(values):
      if not values:
          return None
          
      count_dict = {}
      max_count = 0
      mode = values[0]
      
      for value in values:
          if value in count_dict:
              count_dict[value] += 1
          else:
              count_dict[value] = 1
          
          if count_dict[value] > max_count:
              max_count = count_dict[value]
              mode = value
      
      return mode
  
  assert find_mode([1, 2, 3, 2, 4, 2]) == 2
  assert find_mode([1, 1, 2, 2, 3, 3, 4, 4]) == 1 or find_mode([1, 1, 2, 2, 3, 3, 4, 4]) == 2 or find_mode([1, 1, 2, 2, 3, 3, 4, 4]) == 3 or find_mode([1, 1, 2, 2, 3, 3, 4, 4]) == 4
  assert find_mode([1, 1, 1, 2, 2, 2, 3]) == 1 or find_mode([1, 1, 1, 2, 2, 2, 3]) == 2
  assert find_mode([]) == None
  assert find_mode([5]) == 5
  
output: def find_mode(values):
      if not values:
          return None
          
      count_dict = {}
      max_count = 0
      mode = values[0]
      
      for value in values:
          if value in count_dict:
              count_dict[value] += 1
          else:
              count_dict[value] = 1
          
          if count_dict[value] > max_count:
              max_count = count_dict[value]
              mode = value
      
      return mode