def get_by_path(root, path):
    """Access a nested object in root by path sequence."""

    for k in path if isinstance(path, list) else path.split("."):
        root = root[int(k)] if k.isdigit() else root.get(k, "")

    return root