code: def _cached_get_dataset(
      dataset: str,
      dataset_kwargs: Optional[Mapping[str, Any]],
      force: bool = False,
  ) -> Dataset:
      """Get dataset by name, potentially using file-based cache."""
      from . import dataset_resolver
  
      # normalize dataset kwargs
      dataset_kwargs = dict(dataset_kwargs or {})
  
      # enable passing force option via dataset_kwargs
      force = force or dataset_kwargs.pop("force", False)
  
      # hash kwargs
      digest = _digest_kwargs(
          dataset_kwargs, ignore={"create_inverse_triples"}
      )
  
      # normalize dataset name
      dataset_cls = dataset_resolver.lookup(dataset)
      dataset = dataset_resolver.normalize_cls(dataset_cls)
  
      # get canonic path
      path = PYKEEN_DATASETS.joinpath(dataset, "cache", digest)
  
      # try to use cached dataset
      if path.is_dir() and not force:
          logger.info(
              f"Loading cached preprocessed dataset from {path.as_uri()}"
          )
          return _set_inverse_triples_(
              dataset_cls.from_directory_binary(path),
              create_inverse_triples=dataset_kwargs.get(
                  "create_inverse_triples", False
              ),
          )
  
      # load dataset without cache
      dataset_instance = dataset_resolver.make(dataset, dataset_kwargs)
  
      # store cache
      logger.info(f"Caching preprocessed dataset to {path.as_uri()}")
      dataset_instance.to_directory_binary(path=path)
  
      return dataset_instance
  
file_path: pykeen/src/pykeen/datasets/utils.py
imports: import base64
  import hashlib
  import logging
  import pathlib
  import re
  from typing import Any, Collection, Iterable, Mapping, Optional, Pattern, Tuple, Type, Union
  import click
  from tqdm import tqdm
  from .base import Dataset, EagerDataset, PathDataset
  from ..constants import PYKEEN_DATASETS
  from ..triples import CoreTriplesFactory
label_desc: Use image node_id 6 for calling a global function with example usage: _cached_get_dataset(dataset, dataset_kwargs, force) and returns: dataset_instance, _set_inverse_triples_