docs: def writelog(logfile, contentlist, mode='replace'):
          # type: (AnyStr, Union[AnyStr, List[AnyStr], Tuple[AnyStr]], AnyStr) -> None
          """write log"""
          if logfile is None:  # If logfile is not assigned, just print msg.
              print(UtilClass.print_msg(contentlist))
          else:
              if os.path.exists(logfile):
                  if mode == 'replace':
                      os.remove(logfile)
                      log_status = open(logfile, 'w')
                  else:
                      log_status = open(logfile, 'a')
              else:
                  log_status = open(logfile, 'w')
              log_status.write(UtilClass.print_msg(contentlist))
              log_status.flush()
              log_status.close()