def parse_references(references, in_reply_to):
 replyto = (in_reply_to.split()[0] if in_reply_to else in_reply_to)
 if (not references):
  if replyto:
   return [replyto]
  else:
   return []
 references = references.split()
 if (replyto not in references):
  references.append(replyto)
 return references

def parse_references ( references , in_reply_to ) : replyto = ( in_reply_to . split ( ) [ 0 ] if in_reply_to else in_reply_to ) if ( not references ) : if replyto : return [ replyto ] else : return [ ] references = references . split ( ) if ( replyto not in references ) : references . append ( replyto ) return references
parse a references: header and returns an array of messageids .