def make_message (msg):
    new = Message(msg)
    
    m = msgid_pat.search(msg.get("Message-ID", ""))
    if m is None:
        return None

    new.message_id = m.group(1)

    # Get list of unique message IDs from the References: header
    refs = msg.get("References", "")
    new.references = msgid_pat.findall(refs)
    new.references = uniq(new.references)
    new.subject = msg.get('Subject', "No subject")

    # Get In-Reply-To: header and add it to references
    in_reply_to = msg.get("In-Reply-To", "")
    m = msgid_pat.search(in_reply_to)
    if m:
        msg_id = m.group(1)
        if msg_id not in new.references:
            new.references.append(msg_id)

    return new
make_message(msg:rfc822.Message) : Message
dataset/ETHPy150Open mihaip/mail-trends/jwzthreading.py/make_message