def unpack_singleton(x):
    """

    >>> unpack_singleton([[[[1]]]])
    1
    >>> unpack_singleton(np.array(np.datetime64('2000-01-01')))
    array(datetime.date(2000, 1, 1), dtype='datetime64[D]')
    """
    while isinstance(x, (list, tuple)):
        try:
            x = x[0]
        except (__HOLE__, TypeError, KeyError):
            break
    return x
dataset/ETHPy150Open dask/dask/dask/array/core.py/unpack_singleton