nodes: 0, module; 1, function_definition; 2, function_name:formatted; 3, parameters; 4, comment:# pylint: disable=line-too-long; 5, block; 6, identifier:self; 7, expression_statement; 8, comment:# noqa: E501; 9, comment:# pylint: enable=line-too-long; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:"""
          Return a human readable string with the statistics for this container.
          The operations are sorted by decreasing average time.
  
          The three columns for `ServerTime` are included only if the WBEM server
          has returned WBEM server response times.
  
          Example if statistics are enabled::
  
              Statistics (times in seconds, lengths in Bytes):
              Count Excep         ClientTime              ServerTime             RequestLen                ReplyLen       Operation
                      Cnt     Avg     Min     Max     Avg     Min     Max    Avg    Min    Max      Avg      Min      Max
                  3     0   0.234   0.100   0.401   0.204   0.080   0.361   1233   1000   1500    26667    20000    35000 EnumerateInstances
                  1     0   0.100   0.100   0.100   0.080   0.080   0.080   1200   1200   1200    22000    22000    22000 EnumerateInstanceNames
                  . . .
  
          Example if statistics are disabled::
  
              Statistics (times in seconds, lengths in Bytes):
              Disabled
          """; 14, assignment; 15, attribute; 16, block; 17, else_clause; 18, call; 19, identifier:ret; 20, string:"Statistics (times in seconds, lengths in Bytes):\n"; 21, identifier:self; 22, identifier:enabled; 23, expression_statement; 24, comment:# Test to see if any server time is non-zero; 25, expression_statement; 26, for_statement; 27, comment:# pylint: disable=protected-access; 28, if_statement; 29, for_statement; 30, block; 31, attribute; 32, argument_list; 33, assignment; 34, assignment; 35, pattern_list; 36, identifier:snapshot; 37, comment:# pylint: disable=unused-variable; 38, comment:# pylint: disable=protected-access; 39, block; 40, identifier:include_svr; 41, block; 42, else_clause; 43, pattern_list; 44, identifier:snapshot; 45, comment:# pylint: disable=unused-variable; 46, block; 47, expression_statement; 48, identifier:ret; 49, identifier:strip; 50, identifier:snapshot; 51, call; 52, identifier:include_svr; 53, False; 54, identifier:name; 55, identifier:stats; 56, if_statement; 57, expression_statement; 58, block; 59, identifier:name; 60, identifier:stats; 61, expression_statement; 62, augmented_assignment; 63, identifier:sorted; 64, argument_list; 65, attribute; 66, block; 67, augmented_assignment; 68, expression_statement; 69, augmented_assignment; 70, identifier:ret; 71, string:"Disabled"; 72, call; 73, keyword_argument; 74, keyword_argument; 75, identifier:stats; 76, identifier:_server_time_stored; 77, expression_statement; 78, identifier:ret; 79, attribute; 80, augmented_assignment; 81, identifier:ret; 82, call; 83, attribute; 84, argument_list; 85, identifier:key; 86, lambda; 87, identifier:reverse; 88, True; 89, assignment; 90, identifier:OperationStatistic; 91, identifier:_formatted_header_w_svr; 92, identifier:ret; 93, attribute; 94, attribute; 95, argument_list; 96, identifier:self; 97, identifier:snapshot; 98, lambda_parameters; 99, attribute; 100, identifier:include_svr; 101, True; 102, identifier:OperationStatistic; 103, identifier:_formatted_header; 104, identifier:stats; 105, identifier:formatted; 106, identifier:include_svr; 107, identifier:item; 108, subscript; 109, identifier:avg_time; 110, identifier:item; 111, integer:1
code: def formatted(self):
          # pylint: disable=line-too-long
          """
          Return a human readable string with the statistics for this container.
          The operations are sorted by decreasing average time.
  
          The three columns for `ServerTime` are included only if the WBEM server
          has returned WBEM server response times.
  
          Example if statistics are enabled::
  
              Statistics (times in seconds, lengths in Bytes):
              Count Excep         ClientTime              ServerTime             RequestLen                ReplyLen       Operation
                      Cnt     Avg     Min     Max     Avg     Min     Max    Avg    Min    Max      Avg      Min      Max
                  3     0   0.234   0.100   0.401   0.204   0.080   0.361   1233   1000   1500    26667    20000    35000 EnumerateInstances
                  1     0   0.100   0.100   0.100   0.080   0.080   0.080   1200   1200   1200    22000    22000    22000 EnumerateInstanceNames
                  . . .
  
          Example if statistics are disabled::
  
              Statistics (times in seconds, lengths in Bytes):
              Disabled
          """  # noqa: E501
          # pylint: enable=line-too-long
          ret = "Statistics (times in seconds, lengths in Bytes):\n"
          if self.enabled:
              snapshot = sorted(self.snapshot(),
                                key=lambda item: item[1].avg_time,
                                reverse=True)
  
              # Test to see if any server time is non-zero
              include_svr = False
              for name, stats in snapshot:  # pylint: disable=unused-variable
                  # pylint: disable=protected-access
                  if stats._server_time_stored:
                      include_svr = True
              # pylint: disable=protected-access
              if include_svr:
                  ret += OperationStatistic._formatted_header_w_svr
              else:
                  ret += OperationStatistic._formatted_header
  
              for name, stats in snapshot:  # pylint: disable=unused-variable
                  ret += stats.formatted(include_svr)
          else:
              ret += "Disabled"
          return ret.strip()