def _rfc_transform(msg):
 msgstring = msg.to_string()
 start = msgstring.find('References: ')
 if (start == (-1)):
  return msgstring
 end = msgstring.find('\r\n', (start + len('References: ')))
 substring = msgstring[start:end]
 separator = '\n DCTB '
 rfcmsg = ((msgstring[:start] + substring.replace(' DCTB ', separator)) + msgstring[end:])
 return rfcmsg

def _rfc_transform ( msg ) : msgstring = msg . to_string ( ) start = msgstring . find ( 'References: ' ) if ( start == ( - 1 ) ) : return msgstring end = msgstring . find ( '\r\n' , ( start + len ( 'References: ' ) ) ) substring = msgstring [ start : end ] separator = '\n DCTB ' rfcmsg = ( ( msgstring [ : start ] + substring . replace ( ' DCTB ' , separator ) ) + msgstring [ end : ] ) return rfcmsg
create an rfc-2821 compliant smtp message .