def recursive_get(
    obj: DynaBox | dict[str, int] | dict[str, str | int],
    names: list[str] | None,
) -> Any:
    """Given a dot accessible object and a list of names `foo.bar.[1].zaz`
    gets recursively all names one by one obj.foo.bar.[1].zaz.
    """
    if not names or obj is None:
        return
    head, *tail = names
    if "[" not in head:
        result = getattr(obj, head, None)
    else:
        index = int(head.replace("[", "").replace("]", ""))
        result = obj[index] if index < len(obj) else []

    if not tail:
        return result

    return recursive_get(result, tail)
Given a dot accessible object and a list of names `foo.bar.[1].zaz`
    gets recursively all names one by one obj.foo.bar.[1].zaz.
    
dynaconf/utils/__init__.py