code: def _datadir(request):
      # When using this fixture with parametrized tests, we end up with '[' and ']' characters in the pathname, which TF
      # is not happy with. Thus we should substitute these characters with a more universally accepted path character.
      safe_name = request.node.name.replace("[", "___").replace(
          "]", "___"
      )
  
      dir = test_data_path() / safe_name  # noqa: F821
      shutil.rmtree(str(dir), ignore_errors=True)
      os.makedirs(str(dir))
      return dir
  
file_path: coremltools/coremltools/test/optimize/torch/conftest.py
imports: import os
  import shutil
  from coremltools.test.optimize.torch.models.mnist import mnist_dataset, mnist_model, mnist_model_large, mnist_model_quantization
  from coremltools.test.optimize.torch.pruning.pruning_utils import get_model_and_pruner
  import pytest
label_desc: Use image node_id 2 for calling a global function with example usage: _datadir(request) and returns: dir