input: Write a python function to calculate the information gain of a given feature in a dataset.
  assert information_gain([{'feature1': 'A', 'feature2': 'B', 'label': 'yes'}, {'feature1': 'A', 'feature2': 'C', 'label': 'no'}, {'feature1': 'B', 'feature2': 'B', 'label': 'yes'}, {'feature1': 'B', 'feature2': 'C', 'label': 'no'}], 'feature1') == 0.0
  assert information_gain([{'feature1': 'A', 'feature2': 'B', 'label': 'yes'}, {'feature1': 'A', 'feature2': 'B', 'label': 'no'}, {'feature1': 'B', 'feature2': 'B', 'label': 'yes'}, {'feature1': 'B', 'feature2': 'B', 'label': 'no'}], 'feature2') == 1.0
output: import math
  from collections import Counter
  
  def entropy(data, label_key):
      label_count = Counter([item[label_key] for item in data])
      total_count = len(data)
      entropy_value = 0
      for count in label_count.values():
          probability = count / total_count
          entropy_value -= probability * math.log2(probability)
      return entropy_value
  
  def information_gain(data, feature_key):
      total_entropy = entropy(data, 'label')
      feature_count = Counter([item[feature_key] for item in data])
      total_count = len(data)
      
      feature_entropy = 0
      for feature_value, count in feature_count.items():
          subset = [item for item in data where item[feature_key] == feature_value]
          subset_entropy = entropy(subset, 'label')
          feature_entropy += (count / total_count) * subset_entropy
      
      info_gain = total_entropy - feature_entropy
      return info_gain