code: def write_report(self, session, filename):
          
          if not self.__report:
              session.write_line("No report to write down")
              return
  
          try:
              with open(filename, "w+") as out_file:
                  out_file.write(self.to_json(self.__report))
          except IOError as ex:
              session.write_line("Error writing to file: {0}", ex)
docs: Writes the report in JSON format to the given file