class_docstr: WIT widget base class for common code between Jupyter and Colab.
code: def _json_from_tf_examples(self, tf_examples):
      json_exs = []
      feature_names = self.config.get("feature_names")
      for ex in tf_examples:
          # Create a JSON list or dict for each example depending on settings.
          # Strip out any explicitly-labeled target feature from the example.
          # This is needed because AI Platform models that accept JSON cannot handle
          # when non-input features are provided as part of the object to run
          # prediction on.
          if self.config.get("uses_json_list"):
              json_ex = []
              for feat in ex.features.feature:
                  if feature_names and feat in feature_names:
                      feat_idx = feature_names.index(feat)
                  else:
                      feat_idx = int(feat)
                  if feat == self.config.get(
                      "target_feature"
                  ) or feat_idx == self.config.get("target_feature"):
                      continue
                  # Ensure the example value list is long enough to add the next feature
                  # from the tf.Example.
                  if feat_idx >= len(json_ex):
                      json_ex.extend(
                          [None] * (feat_idx - len(json_ex) + 1)
                      )
                  if ex.features.feature[feat].HasField("int64_list"):
                      json_ex[feat_idx] = ex.features.feature[
                          feat
                      ].int64_list.value[0]
                  elif ex.features.feature[feat].HasField("float_list"):
                      json_ex[feat_idx] = ex.features.feature[
                          feat
                      ].float_list.value[0]
                  else:
                      json_ex[feat_idx] = ensure_str(
                          ex.features.feature[feat].bytes_list.value[0]
                      )
          else:
              json_ex = {}
              for feat in ex.features.feature:
                  if feat == self.config.get("target_feature"):
                      continue
                  if ex.features.feature[feat].HasField("int64_list"):
                      json_ex[feat] = ex.features.feature[
                          feat
                      ].int64_list.value[0]
                  elif ex.features.feature[feat].HasField("float_list"):
                      json_ex[feat] = ex.features.feature[
                          feat
                      ].float_list.value[0]
                  else:
                      json_ex[feat] = ensure_str(
                          ex.features.feature[feat].bytes_list.value[0]
                      )
          json_exs.append(json_ex)
      return json_exs
  
imports: import base64
  import json
  import googleapiclient.discovery
  import os
  import logging
  import multiprocessing
  import tensorflow
  from IPython import display
  from google.protobuf import json_format
  from numbers import Number
  from oauth2client.client import GoogleCredentials
  from six import ensure_str
  from six import integer_types
  from utils import inference_utils
label_desc: Use image node_id 11 for calling the WitWidgetBase obj's underlying member method code with example usage: obj._json_from_tf_examples(tf_examples) and returns: json_exs