def _find_og_ent(ent, base_ents):
    """Find the original entity referenced by $ref entity."""
    id = ent["$ref"]
    return next(bent for bent in base_ents if ("$id" in bent) and bent["$id"] == id)