code: def _dump_impl():
      # type: () -> List[FunctionData]
      
      filtered_signatures = _filter_types(collected_signatures)
      sorted_by_file = sorted(iteritems(filtered_signatures),
                              key=(lambda p: (p[0].path, p[0].line, p[0].func_name)))
      res = []  # type: List[FunctionData]
      for function_key, signatures in sorted_by_file:
          comments = [_make_type_comment(args, ret_type) for args, ret_type in signatures]
          res.append(
              {
                  'path': function_key.path,
                  'line': function_key.line,
                  'func_name': function_key.func_name,
                  'type_comments': comments,
                  'samples': num_samples.get(function_key, 0),
              }
          )
      return res
docs: Internal implementation for dump_stats and dumps_stats