def _get_file(handle):
    '''Returns the filename of the file to read

    If handle is a stream, a temp file is written on disk first
    and its filename is returned'''
    if not isinstance(handle, IOBase):
        return handle

    fd, temp_file = tempfile.mkstemp(str(uuid.uuid4()), prefix='neurom-')
    os.close(fd)
    with open(temp_file, 'w') as fd:
        handle.seek(0)
        shutil.copyfileobj(handle, fd)
    return temp_file
Returns the filename of the file to read

    If handle is a stream, a temp file is written on disk first
    and its filename is returned