def _set_reply_headers(new_message, previous_message):
 if previous_message.message_id_header:
  new_message.in_reply_to = previous_message.message_id_header
  if previous_message.references:
   new_message.references = (previous_message.references + [previous_message.message_id_header])
  else:
   new_message.references = [previous_message.message_id_header]

def _set_reply_headers ( new_message , previous_message ) : if previous_message . message_id_header : new_message . in_reply_to = previous_message . message_id_header if previous_message . references : new_message . references = ( previous_message . references + [ previous_message . message_id_header ] ) else : new_message . references = [ previous_message . message_id_header ]
when creating a draft in reply to a thread .