code: def _check_rules(browser, rules_js, config):
          
          if config.rules_to_run is None:
              msg = 'No accessibility rules were specified to check.'
              log.warning(msg)
              return None
  
          # This line will only be included in the script if rules to check on
          # this page are specified, as the default behavior of the js is to
          # run all rules.
          rules = config.rules_to_run
          if rules:
              rules_config = u"auditConfig.auditRulesToRun = {rules};".format(
                  rules=rules)
          else:
              rules_config = ""
  
          ignored_rules = config.rules_to_ignore
          if ignored_rules:
              rules_config += (
                  u"\nauditConfig.auditRulesToIgnore = {rules};".format(
                      rules=ignored_rules
                  )
              )
  
          script = dedent(u"""
              {rules_js}
              var auditConfig = new axs.AuditConfiguration();
              {rules_config}
              auditConfig.scope = {scope};
              var run_results = axs.Audit.run(auditConfig);
              var audit_results = axs.Audit.auditResults(run_results)
              return audit_results;
          """.format(rules_js=rules_js, rules_config=rules_config, scope=config.scope))
  
          result = browser.execute_script(script)
  
          # audit_results is report of accessibility errors for that session
          audit_results = AuditResults(
              errors=result.get('errors_'),
              warnings=result.get('warnings_')
          )
          return audit_results
docs: Check the page for violations of the configured rules. By default,
          all rules in the ruleset will be checked.
  
          Args:
              browser: a browser instance.
              rules_js: the ruleset JavaScript as a string.
              config: an AxsAuditConfig instance.
  
          Returns:
              A namedtuple with 'errors' and 'warnings' fields whose values are
              the errors and warnings returned from the audit.
  
              None if config has rules_to_run set to None.
  
          __Caution__: You probably don't really want to call this method
          directly! It will be used by `A11yAudit.do_audit` if using this ruleset.