code: def detect_mdn(self):
          
          mdn_message = None
          if self.payload.get_content_type() == 'multipart/report':
              mdn_message = self.payload
          elif self.payload.get_content_type() == 'multipart/signed':
              for part in self.payload.walk():
                  if part.get_content_type() == 'multipart/report':
                      mdn_message = self.payload
  
          if not mdn_message:
              raise MDNNotFound('No MDN found in the received message')
  
          message_id, message_recipient = None, None
          for part in mdn_message.walk():
              if part.get_content_type() == 'message/disposition-notification':
                  mdn = part.get_payload()[0]
                  message_id = mdn.get('Original-Message-ID').strip('<>')
                  message_recipient = mdn.get(
                      'Original-Recipient').split(';')[1].strip()
          return message_id, message_recipient
docs: Function checks if the received raw message is an AS2 MDN or not.
  
          :raises MDNNotFound: If the received payload is not an MDN then this
          exception is raised.
  
          :return:
              A two element tuple containing (message_id, message_recipient). The
              message_id is the original AS2 message id and the message_recipient
              is the original AS2 message recipient.