from typing import Iterable
import functools
from operator import getitem


def get_in(keys: Iterable):

    """Creates a function that returns coll[i0][i1]...[iX] where [i0, i1, ..., iX]==keys.

    >>> get_in(["a", "b", 1])({"a": {"b": [0, 1, 2]}})
    1
    """

    def get_in(coll):
        return functools.reduce(getitem, keys, coll)

    return get_in