<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ignore_rules_for_url(spider, url):
 """ Returns a list of ignore rules from the given spider, that are relevant to the given URL. """

    ignore_rules = getattr(spider, "pa11y_ignore_rules", {}) or {}
    return itertools.chain.from_iterable(
        rule_list
        for url_glob, rule_list
        in ignore_rules.items()
        if fnmatch.fnmatch(url, url_glob)
    )