code: def _filter_sframe(filters, row_type, mat_type, sf, evaluation):
      conf_metric = evaluation._data["confidence_metric_for_threshold"]
  
      if mat_type == "conf_wrong":
          sf = sf[
              sf[conf_metric] > evaluation._data["confidence_threshold"]
          ]
      elif mat_type == "hesitant":
          sf = sf[
              sf[conf_metric] < evaluation._data["hesitant_threshold"]
          ]
  
      filtered_array = None
      if row_type == "corrects":
          sf = sf.filter_by([True], "correct")
      elif row_type == "incorrects":
          sf = sf.filter_by([False], "correct")
  
      if len(filters) == 0:
          return sf
  
      for f in filters:
          target_label = f["target_label"]
          predicted_label = f["predicted_label"]
          filtered_sframe = sf.filter_by(
              [target_label], "target_label"
          ).filter_by([predicted_label], "predicted_label")
          if filtered_array is None:
              filtered_array = filtered_sframe
          else:
              filtered_array = filtered_array.append(filtered_sframe)
  
      return filtered_array
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from ...visualization import _get_client_app_path
  import turicreate
  import subprocess
  import six
  from six.moves import _thread
  import json
  import base64
  import math
label_desc: Use image node_id 3 for calling a global function with example usage: _filter_sframe(filters, row_type, mat_type, sf, evaluation) and returns: filtered_array, sf