class_docstr: Handles a ListSessionGroups request.
class_docstr_tok: ["Handles","a","ListSessionGroups","request","."]
docstr: Sorts 'session_groups' in place according to _request.col_params.
code: def _sort(self, session_groups, extractors):
      """Sorts 'session_groups' in place according to _request.col_params."""
  
      # Sort by session_group name so we have a deterministic order.
      session_groups.sort(key=operator.attrgetter("name"))
      # Sort by lexicographical order of the _request.col_params whose order
      # is not ORDER_UNSPECIFIED. The first such column is the primary sorting
      # key, the second is the secondary sorting key, etc. To achieve that we
      # need to iterate on these columns in reverse order (thus the primary key
      # is the key used in the last sort).
      for col_param, extractor in reversed(
          list(zip(self._request.col_params, extractors))
      ):
          if col_param.order == api_pb2.ORDER_UNSPECIFIED:
              continue
          if col_param.order == api_pb2.ORDER_ASC:
              session_groups.sort(
                  key=_create_key_func(
                      extractor,
                      none_is_largest=not col_param.missing_values_first,
                  )
              )
          elif col_param.order == api_pb2.ORDER_DESC:
              session_groups.sort(
                  key=_create_key_func(
                      extractor,
                      none_is_largest=col_param.missing_values_first,
                  ),
                  reverse=True,
              )
          else:
              raise error.HParamsError(
                  "Unknown col_param.order given: %s" % col_param
              )
  
imports: import collections
  import dataclasses
  import operator
  import re
  from typing import Optional
  from google.protobuf import struct_pb2
  from tensorboard.data import provider
  from tensorboard.plugins.hparams import api_pb2
  from tensorboard.plugins.hparams import backend_context
  from tensorboard.plugins.hparams import error
  from tensorboard.plugins.hparams import json_format_compat
  from tensorboard.plugins.hparams import metadata
  from tensorboard.plugins.hparams import metrics
  from tensorboard.plugins.hparams import plugin_data_pb2
label_desc: Use image node_id 12 for calling the Handler obj's underlying member method code with example usage: obj._sort(session_groups, extractors) without return types