'Saves the TranslationUnit to a file.
This is equivalent to passing -emit-ast to the clang frontend. The
saved file can be loaded back into a TranslationUnit. Or, if it
corresponds to a header, it can be used as a pre-compiled header file.
If an error occurs while saving, a TranslationUnitSaveError is raised.
If the error was TranslationUnitSaveError.ERROR_INVALID_TU, this means
the constructed TranslationUnit was not valid at time of save. In this
case, the reason(s) why should be available via
TranslationUnit.diagnostics().
filename -- The path to save the translation unit to.'

def save(self, filename):

    options = conf.lib.clang_defaultSaveOptions(self)
    result = int(conf.lib.clang_saveTranslationUnit(self, filename, options))
    if (result != 0):
        raise TranslationUnitSaveError(result, 'Error    saving    TranslationUnit.')
