import copy


def elide_curies(payload):
    """Elide CURIES in TRAPI request/response."""
    payload = copy.deepcopy(payload)
    if "message" not in payload:
        return payload
    for qnode in payload["message"]["query_graph"]["nodes"].values():
        if (num_curies := len(qnode.get("ids", None) or [])) > 10:
            qnode["ids"] = f"**{num_curies} CURIEs not shown for brevity**"
    return payload