<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_rules(self, rules):
 """ Set rules to ignore XOR limit to when checking for accessibility errors on the page. Args: rules: a dictionary one of the following formats. If you want to run all of the rules except for some:: {"ignore": []} If you want to run only a specific set of rules:: {"apply": []} If you want to run only rules of a specific standard:: {"tags": []} Examples: To run only "bad-link" and "color-contrast" rules:: page.a11y_audit.config.set_rules({ "apply": ["bad-link", "color-contrast"], }) To run all rules except for "bad-link" and "color-contrast":: page.a11y_audit.config.set_rules({ "ignore": ["bad-link", "color-contrast"], }) To run only WCAG 2.0 Level A rules:: page.a11y_audit.config.set_rules({ "tags": ["wcag2a"], }) To run all rules: page.a11y_audit.config.set_rules({}) Related documentation: * https://github.com/dequelabs/axe-core/blob/master/doc/API.md#options-parameter-examples * https://github.com/dequelabs/axe-core/doc/rule-descriptions.md """

        options = {}
        if rules:
            if rules.get("ignore"):
                options["rules"] = {}
                for rule in rules.get("ignore"):
                    options["rules"][rule] = {"enabled": False}
            elif rules.get("apply"):
                options["runOnly"] = {
                    "type": "rule",
                    "values": rules.get("apply"),
                }
            elif rules.get("tags"):
                options["runOnly"] = {
                    "type": "tag",
                    "values": rules.get("tags"),
                }
        self.rules = json.dumps(options)