'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.'

def _WriteNagFile(self, nag):

    nagfilename = SDKUpdateChecker.MakeNagFilename()
    try:
        fh = open(nagfilename, 'w')
        try:
            fh.write(nag.ToYAML())
        finally:
            fh.close()
    except (OSError, IOError) as e:
        logging.error('Could    not    write    nag    file    to    %s.    Error:    %s', nagfilename, e)
