code: def substitute_variables(command, level, name, value, target=None, **kwargs):
      
      rule = kwargs.get('rule', {})
      rule_value = rule.get('value', '') if rule else ''
      substitutes = {
          '${level}': str(level),
          '${target}': str(target),
          '${name}': '"' + str(name) + '"',
          '${value}': str(value),
          '${limit_value}': str(rule_value),
      }
  
      result = command
      for pattern, value in substitutes.items():
          result = result.replace(pattern, value)
  
      return result
docs: Substitute variables in command fragments by values e.g. ${level} => 'warning'.