code: def setup_directories(base_dir, subdirs):
    
    base_dir = os.path.expanduser(base_dir)
    tf.gfile.MakeDirs(base_dir)
  
    all_dirs = {}
    for subdir in subdirs:
      if isinstance(subdir, six.string_types):
        subdir_tuple = (subdir,)
      else:
        subdir_tuple = subdir
      dir_name = os.path.join(base_dir, *subdir_tuple)
      tf.gfile.MakeDirs(dir_name)
      all_dirs[subdir] = dir_name
    return all_dirs
docs: Setup directories.