code: def _ConvertCollectionsCounterToDict(cls, collections_counter):
      
      if not isinstance(collections_counter, collections.Counter):
        raise TypeError
  
      json_dict = {'__type__': 'collections.Counter'}
      for attribute_name, attribute_value in iter(collections_counter.items()):
        if attribute_value is None:
          continue
  
        if isinstance(attribute_value, py2to3.BYTES_TYPE):
          attribute_value = {
              '__type__': 'bytes',
              'stream': '{0:s}'.format(binascii.b2a_qp(attribute_value))
          }
  
        json_dict[attribute_name] = attribute_value
  
      return json_dict
docs: Converts a collections.Counter object into a JSON dictionary.
  
      The resulting dictionary of the JSON serialized objects consists of:
      {
          '__type__': 'collections.Counter'
          ...
      }
  
      Here '__type__' indicates the object base type. In this case
      'collections.Counter'. The rest of the elements of the dictionary make up
      the collections.Counter object attributes.
  
      Args:
        collections_counter (collections.Counter): counter.
  
      Returns:
        dict[str, object]: JSON serialized objects.
  
      Raises:
        TypeError: if not an instance of collections.Counter.