def write_log(self, fs=None):
log = StringIO.StringIO()<EOL>log.write(self.setup_src)<EOL>if not self.is_class_method:<EOL><INDENT>time_avg = convert_time_units(self.time_average_seconds)<EOL>log.write("<STR_LIT>".format(time_avg))<EOL><DEDENT>if fs:<EOL><INDENT>with open(fs, '<STR_LIT:w>') as _f:<EOL><INDENT>_f.write(log.getvalue())<EOL><DEDENT><DEDENT>
Write the results of the benchmark to a log file.
:param fs: file-like object.