code: def _append_defects(self, part, part_content_type):
          
  
          part_defects = {}
  
          for e in part.defects:
              defects = "{}: {}".format(e.__class__.__name__, e.__doc__)
              self._defects_categories.add(e.__class__.__name__)
              part_defects.setdefault(part_content_type, []).append(defects)
              log.debug("Added defect {!r}".format(defects))
  
          # Tag mail with defect
          if part_defects:
              self._has_defects = True
  
              # Save all defects
              self._defects.append(part_defects)
docs: Add new defects and defects categories to object attributes.
  
          The defects are a list of all the problems found
          when parsing this message.
  
          Args:
              part (string): mail part
              part_content_type (string): content type of part