def METHOD_NAME(node, parent_field):
    for field, value in node.items():
        if field == "x-cap-permission":
            x_cap_fields.append({"path": parent_field, "value": value})
        if isinstance(value, dict):
            METHOD_NAME(value, parent_field + [field])
        if isinstance(value, list):
            for index, v in enumerate(value):
                if isinstance(v, dict):
                    METHOD_NAME(
                        v, parent_field + [field] + [index]
                    )