code: def entropy_of_contacts(records, normalize=False):
      
      counter = Counter(r.correspondent_id for r in records)
  
      raw_entropy = entropy(counter.values())
      n = len(counter)
      if normalize and n > 1:
          return raw_entropy / math.log(n)
      else:
          return raw_entropy
docs: The entropy of the user's contacts.
  
      Parameters
      ----------
      normalize: boolean, default is False
          Returns a normalized entropy between 0 and 1.