code: def format_msg(external_id, external_id_prop, wdid, msg, msg_type=None, delimiter=";"):
      
      fmt = ('{}' + delimiter) * 4 + '{}'  # '{};{};{};{};{}'
      d = {'external_id': external_id,
           'external_id_prop': external_id_prop,
           'wdid': wdid,
           'msg': msg,
           'msg_type': msg_type}
      for k, v in d.items():
          if isinstance(v, str) and delimiter in v and '"' in v:
              v = v.replace('"', "'")
          if isinstance(v, str) and delimiter in v:
              d[k] = '"' + v + '"'
  
      s = fmt.format(d['external_id'], d['external_id_prop'], d['wdid'], d['msg'], d['msg_type'])
      return s
docs: Format message for logging
      :return: str