code: def fetch_email(M, msg_id):
      
      res, data = M.fetch(msg_id, '(RFC822)')
      if res == 'OK':
          # Data here is a list with 1 element containing a tuple
          # whose 2nd element is a long string containing the email
          # The content is a bytes that must be decoded
          raw_msg_txt = data[0][1]
          # In Python3, we call message_from_bytes, but this function doesn't
          # exist in Python 2.
          try:
              msg = email.message_from_bytes(raw_msg_txt)
          except AttributeError:
              msg = email.message_from_string(raw_msg_txt)
          # At this point, we have a message containing bytes (not unicode)
          # fields that will still need to be decoded, ideally according to the
          # character set specified in the message.
          return msg
      else:
          return None
docs: Returns the given email message as a unicode string.