def _get_dataset(dataset_name, dataset_prefix=None,
                 data_dir=None, default_paths=None,
                 verbose=1):
    """ Create if necessary and returns data directory of given dataset.

    data_dir: str
      Path of the data directory. Used to force data storage in
      a specified location.
    default_paths: list(str)
      Default system paths in which the dataset may already have been installed
      by a third party software. They will be checked first.
    verbose: int
      verbosity level (0 means no message).

    :returns: the path of the given dataset directory.
    :rtype: str

    .. note::

      This function retrieves the datasets directory (or data directory) using
      the following priority :

        1. defaults system paths
        2. the keyword argument data_dir
        3. the global environment variable CRN_SHARED_DATA
        4. the user environment variable CRN_DATA
        5. ~/.cache/stanford-crn in the user home folder


    """

    dataset_folder = dataset_name if not dataset_prefix \
        else '%s%s' % (dataset_prefix, dataset_name)
    default_paths = default_paths or ''
    paths = [p / dataset_folder for p in _get_data_path(data_dir)]
    all_paths = [Path(p) / dataset_folder
                 for p in default_paths.split(os.pathsep)] + paths

    # Check if the dataset folder exists somewhere and is not empty
    for path in all_paths:
        if path.is_dir() and list(path.iterdir()):
            if verbose > 1:
                NIWORKFLOWS_LOG.info(
                    'Dataset "%s" already cached in %s', dataset_name, path)
            return path, True

    for path in paths:
        if verbose > 0:
            NIWORKFLOWS_LOG.info(
                'Dataset "%s" not cached, downloading to %s', dataset_name, path)
        path.mkdir(parents=True, exist_ok=True)
        return path, False
Create if necessary and returns data directory of given dataset.

    data_dir: str
      Path of the data directory. Used to force data storage in
      a specified location.
    default_paths: list(str)
      Default system paths in which the dataset may already have been installed
      by a third party software. They will be checked first.
    verbose: int
      verbosity level (0 means no message).

    :returns: the path of the given dataset directory.
    :rtype: str

    .. note::

      This function retrieves the datasets directory (or data directory) using
      the following priority :

        1. defaults system paths
        2. the keyword argument data_dir
        3. the global environment variable CRN_SHARED_DATA
        4. the user environment variable CRN_DATA
        5. ~/.cache/stanford-crn in the user home folder