def _get_backing_memmap(a):
    b = getattr(a, 'base', None)
    if b is None:
        # TODO: check scipy sparse datastructure if scipy is installed
        # a nor its descendants do not have a memmap base
        return None

    elif isinstance(b, mmap):
        # a is already a real memmap instance.
        return a

    else:
        # Recursive exploration of the base ancestry
        return _get_backing_memmap(b)
Recursively look up the original np.memmap instance base if any
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/externals/joblib/pool.py/_get_backing_memmap