function isReadOnlyCommand(command, connection) {
  // check dynamic command list for this connection if available
  if (connection.options.commandList && connection.options.commandList.ro.length > 0) {
    return connection.options.commandList.ro.some((cmd) => cmd === command);
  }
  else {
    // fallback hardcoded list
    let commandUpper = command.toUpperCase();
    let commandSpace = commandUpper + ' ';
    return redisCoreCmds.readCmds.some(function(roCmd) {
      return roCmd === commandUpper || roCmd.startsWith(commandSpace);
    });
  }
}
check if given command is a read-only command for the connection.
 If server supports listing all commands this list includes all commands the server
 understands (also plugin commands). If server does not support "command" commando
 this check is done again a hardcoded list of read-only commands, therefore may miss
 some legit commands for newer servers or servers with extra plugins enabled.

 @param {string} command command name in lower case to check
 @param {Redis} connection active redis connection object with optional additional command list attached
 @return {boolean} true if command does not modify state of server