class_docstr: ModelService wraps up all preprocessing, inference and postprocessing
  functions used by model service. It is defined in a flexible manner to
  be easily extended to support different frameworks.
class_docstr_tok: ["ModelService","wraps","up","all","preprocessing",",","inference","and","postprocessing","functions","used","by","model","service",".","It","is","defined","in","a","flexible","manner","to","be","easily","extended","to","support","different","frameworks","."]
docstr: Backward compatible handle function.
  
  :param data:
  :param context:
  :return:
docstr_tok: ["Backward","compatible","handle","function",".",":","param","data",":",":","param","context",":",":","return",":"]
code: def handle(self, data, context):  # pylint: disable=unused-argument
      """
      Backward compatible handle function.
  
      :param data:
      :param context:
      :return:
  
      """
      input_type = self._signature["input_type"]
  
      input_data = []
      data_name = self._signature["inputs"][0]["data_name"]
      form_data = data[0].get(data_name)
      if form_data is None:
          form_data = data[0].get("body")
  
      if form_data is None:
          form_data = data[0].get("data")
  
      if input_type == "application/json":
          # user might not send content in HTTP request
          if isinstance(form_data, (bytes, bytearray)):
              form_data = ast.literal_eval(form_data.decode("utf-8"))
  
      input_data.append(form_data)
  
      ret = self.inference(input_data)
      if isinstance(ret, list):
          return ret
  
      return [ret]
  
file_path: serve/ts/model_service/model_service.py
imports: import ast
  import json
  import logging
  import os
  import time
  from abc import ABCMeta, abstractmethod
label_desc: Use image node_id 6 for calling the ModelService obj's underlying member method code with example usage: obj.handle(data, context) and returns: list, ret