code: def count_by_key_impl(sequence):
      
      counter = collections.Counter()
      for key, _ in sequence:
          counter[key] += 1
      return six.viewitems(counter)
docs: Implementation for count_by_key_t
      :param sequence: sequence of (key, value) pairs
      :return: counts by key