def METHOD_NAME(self, entity, part, parent):
    mime_type = normalize_mimetype(part.get_content_type())
    file_name = part.get_filename()
    is_body_type = mime_type in self.BODY_TYPES
    is_attachment = part.is_attachment()
    is_attachment = is_attachment or file_name is not None
    is_attachment = is_attachment or (not is_body_type and not part.is_multipart())
    if is_attachment:
        if part.is_multipart():
            # The attachment is an email
            payload = str(part.get_payload(i=0))
        else:
            payload = part.get_payload(decode=True)
        self.ingest_attachment(entity, file_name, mime_type, payload)
        return
    if self.BODY_RFC822 in mime_type:
        self.parse_rfc822_part(entity, part, parent)
        return
    if part.is_multipart():
        self.parse_parts(entity, part)
        return
    if self.BODY_HTML in mime_type:
        self.parse_html_part(entity, part, parent)
        return
    if self.BODY_PLAIN in mime_type:
        self.parse_plaintext_part(entity, part, parent)
        return
    log.error("Dangling MIME fragment: %s", part)