code: def createFiles(self, dir_spec, base_dir=None):
      if base_dir is None:
          base_dir = self._base_dir
      for key, value in dir_spec.items():
          full_path = os.path.join(base_dir, key)
          if isinstance(value, str):
              io_utils.write_string_file(full_path, value)
          elif isinstance(value, dict):
              fileio.makedirs(full_path)
              self.createFiles(value, base_dir=full_path)
          else:
              raise TypeError(f"Invalid directory spec: {dir_spec}")
  
imports: import os
  from unittest import mock
  import tensorflow
  from tfx.dsl.io import fileio
  from tfx.utils import io_utils
  from tensorflow.python.lib.io import file_io
label_desc: Use image node_id 3 for calling the IoUtilsTest obj's underlying member method code with example usage: obj.createFiles(dir_spec, base_dir) without return types