def deepfirst(seq):
    if not isinstance(seq, (list, tuple)):
        return seq
    else:
        return deepfirst(seq[0])
First element in a nested list
dataset/ETHPy150Open dask/dask/dask/array/core.py/deepfirst