<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def WriteConfig(self, config_file=None):
 """Write the config values to a given file. Args: config_file: string, the file location of the config file to write. """

    config_file = config_file or self.config_file
    config_name = os.path.splitext(os.path.basename(config_file))[0]
    config_lock = (
        '%s/lock/google_%s.lock' % (constants.LOCALSTATEDIR, config_name))
    with file_utils.LockFile(config_lock):
      with open(config_file, 'w') as config_fp:
        if self.config_header:
          self._AddHeader(config_fp)
        self.config.write(config_fp)