class_docstr: Middleware for injecting client-side feature flags into the Context.
  
  The client webapp is expected to include a json-serialized version of its
  FeatureFlags in the `X-TensorBoard-Feature-Flags` header or the
  `tensorBoardFeatureFlags` query parameter. This middleware extracts the
  header or query parameter value and converts it into the client_feature_flags
  property for the DataProvider's Context object, where client_feature_flags
  is a Dict of string keys and arbitrary value types.
  
  In the event that both the header and query parameter are specified, the
  values from the header will take precedence.
code: def _parse_potential_query_param_flags(self, query_string):
      if not query_string:
          return {}
  
      try:
          query_string_json = urllib.parse.parse_qs(query_string)
      except ValueError:
          return {}
  
      # parse_qs returns the dictionary values as lists for each name.
      potential_feature_flags = query_string_json.get(
          "tensorBoardFeatureFlags", []
      )
      if not potential_feature_flags:
          return {}
      try:
          client_feature_flags = json.loads(potential_feature_flags[0])
      except json.JSONDecodeError:
          raise errors.InvalidArgumentError(
              "tensorBoardFeatureFlags cannot be JSON decoded."
          )
  
      if not isinstance(client_feature_flags, dict):
          raise errors.InvalidArgumentError(
              "tensorBoardFeatureFlags cannot be decoded to a dict."
          )
  
      return client_feature_flags
  
file_path: tensorboard/tensorboard/backend/client_feature_flags.py
imports: import json
  import urllib.parse
  from tensorboard import context
  from tensorboard import errors
label_desc: Use image node_id 4 for calling the ClientFeatureFlagsMiddleware obj's underlying member method code with example usage: obj._parse_potential_query_param_flags(query_string) and returns: client_feature_flags, dict, dict, dict