def _WriteNagFile(self, nag):
    """Writes the NagFile to the user's nag file.

    If the destination path does not exist, this method will log an error
    and fail silently.

    Args:
      nag: The NagFile to write.
    """
    nagfilename = SDKUpdateChecker.MakeNagFilename()
    try:
      fh = open(nagfilename, 'w')
      try:
        fh.write(nag.ToYAML())
      finally:
        fh.close()
    except (OSError, __HOLE__), e:
      logging.error('Could not write nag file to %s. Error: %s', nagfilename, e)
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/tools/sdk_update_checker.py/SDKUpdateChecker._WriteNagFile