def METHOD_NAME(prefixes_and_configs: list[tuple[str, dict[str, Any]]]) -> dict[str, Any]:
    """
    Merge two PII configs into one, prefixing all custom rules with a prefix in the name.
    This is used to apply organization and project configs at once,
    and still get unique references to rule names.
    """
    merged_config: dict[str, Any] = {}
    for prefix, partial_config in prefixes_and_configs:
        if not partial_config:
            continue
        rules = partial_config.get("rules") or {}
        for rule_name, rule in rules.items():
            prefixed_rule_name = f"{prefix}{rule_name}"
            merged_config.setdefault("rules", {})[
                prefixed_rule_name
            ] = _prefix_rule_references_in_rule(rules, rule, prefix)
        for selector, applications in (partial_config.get("applications") or {}).items():
            merged_applications = merged_config.setdefault("applications", {}).setdefault(
                selector, []
            )
            for application in applications:
                if application in rules:
                    prefixed_rule_name = f"{prefix}{application}"
                    merged_applications.append(prefixed_rule_name)
                else:
                    merged_applications.append(application)
    return merged_config