code: def save_config(config, logdir=None):
    
    if logdir:
      with config.unlocked:
        config.logdir = logdir
      message = 'Start a new run and write summaries and checkpoints to {}.'
      tf.logging.info(message.format(config.logdir))
      tf.gfile.MakeDirs(config.logdir)
      config_path = os.path.join(config.logdir, 'config.yaml')
      with tf.gfile.FastGFile(config_path, 'w') as file_:
        yaml.dump(config, file_, default_flow_style=False)
    else:
      message = (
          'Start a new run without storing summaries and checkpoints since no '
          'logging directory was specified.')
      tf.logging.info(message)
    return config
docs: Save a new configuration by name.
  
    If a logging directory is specified, is will be created and the configuration
    will be stored there. Otherwise, a log message will be printed.
  
    Args:
      config: Configuration object.
      logdir: Location for writing summaries and checkpoints if specified.
  
    Returns:
      Configuration object.