def all_queries(obj: Any, query: Lens = None) -> Iterable[Lens]:
    """
    Get all queries for the given object.
    """

    query = query or Lens()

    if isinstance(obj, JSON_BASES):
        yield query

    elif isinstance(obj, pydantic.BaseModel):
        yield query

        for k in type(obj).model_fields:
            v = getattr(obj, k)
            sub_query = query[k]
            yield from all_queries(v, sub_query)

    elif isinstance(obj, Dict):
        yield query

        for k, v in obj.items():
            sub_query = query[k]
            yield from all_queries(obj[k], sub_query)

    elif isinstance(obj, Sequence):
        yield query

        for i, v in enumerate(obj):
            sub_query = query[i]
            yield from all_queries(obj[i], sub_query)

    else:
        yield query

    Get all queries for the given object.
    
src/core/trulens/core/utils/serial.py