code: def save(self, label='default', path=None):
          
          # What will we write out?
          cfg = vars(self)
          if 'version' in cfg:  # pragma: no cover
              cfg['version'] = str(cfg['version'])
  
          # Where is the file we're writing to?
          if path is None:
              path = join(
                  BaseDirectory.save_config_path(self._xdg_config_dir),
                  self._xdg_config_file
              )
          self._file_lock.acquire()
  
          try:
              # Either read an existing config or make an empty one. Then update
              # the config and write it out.
              try:
                  with open(path) as config_file:
                      config = json.load(config_file)
              except IOError:  # pragma: no cover
                  config = {}
              config[label] = cfg
              with open(path, 'w') as config_file:
                  json.dump(config, config_file)
          finally:
              self._file_lock.release()
docs: Save the current connection configuration to a file.
  
          This method is thread safe.
  
          :param label: A string. An identifier for the current configuration.
              This allows multiple configurations with unique labels to be saved
              in a single file. If a configuration identified by ``label``
              already exists in the destination configuration file, it is
              replaced.
          :param path: A string. The configuration file to be manipulated. By
              default, an XDG-compliant configuration file is used. A
              configuration file is created if one does not exist already.
          :returns: ``None``