def serve_nidm(request, collection_cid, nidmdir, sep, path):
    collection = get_collection(collection_cid, request, mode='file')
    basepath = os.path.join(settings.PRIVATE_MEDIA_ROOT, 'images')
    fpath = path if sep is '/' else ''.join([nidmdir, sep, path])
    try:
        nidmr = collection.basecollectionitem_set.instance_of(NIDMResults).get(name=nidmdir)
    except __HOLE__:
        return HttpResponseForbidden()

    if path in ['zip', 'ttl', 'provn']:
        fieldf = getattr(nidmr, '{0}_file'.format(path))
        fpath = fieldf.path
    else:
        zipfile = nidmr.zip_file.path
        fpathbase = os.path.dirname(zipfile)
        fpath = ''.join([fpathbase,sep,path])

    return sendfile(request, os.path.join(basepath, fpath), encoding="utf-8")
dataset/ETHPy150Open NeuroVault/NeuroVault/neurovault/apps/statmaps/views.py/serve_nidm