docs: def annotate(self, out, filename=None, commandline=None, relative_path=False):
          """
          Dump annotated source code with current profiling statistics to "out"
          file.
          Time unit: second.
          out (file-ish opened for writing)
              Destination of annotated sources.
          filename (str, collection of str)
              If provided, dump stats for given source file(s) only.
              If unordered collection, it will get sorted by decreasing total
              file score (total time if available, then total hit count).
              By default, list for all known files.
          commandline (anything with __str__)
              If provided, will be output as the command line used to generate
              this annotation.
          relative_path (bool)
              For compatibility with callgrind. Ignored.
          """
          file_dict = self._mergeFileTiming()
          total_time = self.total_time
          if commandline is not None:
              print(u'Command line:', commandline, file=out)
          print(u'Total duration: %gs' % total_time, file=out)
          if not total_time:
              return
          def percent(value, scale):
              if scale == 0:
                  return 0
              return value * 100 / scale
          for name in self._getFileNameList(filename):
              file_timing = file_dict[name]
              file_total_time = file_timing.getTotalTime()
              call_list_by_line = file_timing.getCallListByLine()
              print(u'File: %s' % name, file=out)
              print(u'File duration: %gs (%.2f%%)' % (file_total_time,
                  percent(file_total_time, total_time)), file=out)
              print(_ANNOTATE_HEADER, file=out)
              print(_ANNOTATE_HORIZONTAL_LINE, file=out)
              last_line = file_timing.getLastLine()
              for lineno, line in LineIterator(
                  self._getline,
                  file_timing.filename,
                  file_timing.global_dict,
              ):
                  if not line and lineno > last_line:
                      break
                  hits, duration = file_timing.getHitStatsFor(lineno)
                  print(_ANNOTATE_FORMAT % {
                      u'lineno': lineno,
                      u'hits': hits,
                      u'time': duration,
                      u'time_per_hit': duration / hits if hits else 0,
                      u'percent': percent(duration, total_time),
                      u'line': (line or u'').rstrip(),
                  }, file=out)
                  for (
                      _,
                      call_hits, call_duration,
                      callee_file, callee,
                  ) in call_list_by_line.get(lineno, ()):
                      print(_ANNOTATE_CALL_FORMAT % {
                          u'hits': call_hits,
                          u'time': call_duration,
                          u'time_per_hit': call_duration / call_hits,
                          u'percent': percent(call_duration, total_time),
                          u'callee_file': callee_file,
                          u'callee_line': callee.co_firstlineno,
                          u'callee_name': callee.co_name,
                      }, file=out)