def exportTrace(self, traceName, fileName, format = "binary", **kwargs):
    """
    Export a trace to a file in a special format.

    @param traceName:   Trace to save
    @param fileName:    Output trace file
    @param format:      Output trace format
    @param **kwargs:    Keyword arguments for the exporter plugin
    """
    if not traceName in self.analyzer.traces:
      self.analyzer.fail("Trace not found: %s" % traceName)
      
    trace = self.analyzer.traces[traceName]
    
    for exporter in self.analyzer.exportPlugins:
      if exporter.formatName == format:
        break
    else:
      self.analyzer.fail((", ".join([e.formatName for e in self.analyzer.exportPlugins])) % "No such format. Available formats: %s.")

    kwargs = Analyzer.completeKeywordArguments(exporter.saveTrace, kwargs)

    try:
      f = open(fileName, "wb")
      exporter.saveTrace(trace, f, **kwargs)
      f.close()
      # If the file is in binary format, record the output file
      if format == "binary":
        self.analyzer.traceFiles[traceName] = fileName
        self.reportInfo("Saved trace %s to '%s'." % (traceName, fileName))
      else:
        self.reportInfo("Exported trace %s to '%s' in %s format." % (traceName, fileName, format))
    except IOError, e:
      self.analyzer.fail(e)
dataset/ETHPy150Open skyostil/tracy/src/analyzer/plugins/core/CorePlugin.py/CoreInteractivePlugin.exportTrace/swapped operands of `%`