def _build_rules(specs):
    """Adapts the list of anillo urlmapping specs into
    a list of werkzeug rules or rules subclasses.

    :param list specs: A list of anillo url mapping specs.
    :return: generator
    """
    for spec in specs:
        if "context" in spec:
            yield Context(spec["context"], list(_build_rules(spec.get("routes", []))))
        else:
            rulespec = spec.copy()
            match = rulespec.pop("match")
            name = rulespec.pop("name")
            yield Rule(match, endpoint=name, **rulespec)
Adapts the list of anillo urlmapping specs into
    a list of werkzeug rules or rules subclasses.

    :param list specs: A list of anillo url mapping specs.
    :return: generator