code: def _ConvertAttributeValueToDict(cls, attribute_value):
      
      if isinstance(attribute_value, py2to3.BYTES_TYPE):
        encoded_value = binascii.b2a_qp(attribute_value)
        encoded_value = codecs.decode(encoded_value, 'ascii')
        attribute_value = {
            '__type__': 'bytes',
            'stream': '{0:s}'.format(encoded_value)
        }
  
      elif isinstance(attribute_value, (list, tuple)):
        json_list = []
        for list_element in attribute_value:
          json_dict = cls._ConvertAttributeValueToDict(list_element)
          json_list.append(json_dict)
  
        if isinstance(attribute_value, list):
          attribute_value = json_list
        else:
          attribute_value = {
              '__type__': 'tuple',
              'values': json_list
          }
  
      elif isinstance(attribute_value, collections.Counter):
        attribute_value = cls._ConvertCollectionsCounterToDict(attribute_value)
  
      elif isinstance(attribute_value, dfvfs_path_spec.PathSpec):
        attribute_value = cls._ConvertPathSpecToDict(attribute_value)
  
      elif isinstance(attribute_value, containers_interface.AttributeContainer):
        attribute_value = cls._ConvertAttributeContainerToDict(attribute_value)
  
      return attribute_value
docs: Converts an attribute value into a JSON dictionary.
  
      Args:
        attribute_value (object): an attribute value.
  
      Returns:
        dict|list: The JSON serialized object which can be a dictionary or a list.