docs: def serialize(material_description):
      # type: (Dict[Text, Text]) -> dynamodb_types.BINARY_ATTRIBUTE
      """Serialize a material description dictionary into a DynamodDB attribute.
  
      :param dict material_description: Material description dictionary
      :returns: Serialized material description as a DynamoDB binary attribute value
      :rtype: dict
      :raises InvalidMaterialDescriptionError: if invalid name or value found in material description
      """
      material_description_bytes = bytearray(_MATERIAL_DESCRIPTION_VERSION)
  
      # TODO: verify Java sorting order
      for name, value in sorted(material_description.items(), key=lambda x: x[0]):
          try:
              material_description_bytes.extend(encode_value(to_bytes(name)))
              material_description_bytes.extend(encode_value(to_bytes(value)))
          except (TypeError, struct.error):
              raise InvalidMaterialDescriptionError(
                  'Invalid name or value in material description: "{name}"="{value}"'.format(name=name, value=value)
              )
  
      return {Tag.BINARY.dynamodb_tag: bytes(material_description_bytes)}