code: def output_fn(prediction, accept):
      if accept == "application/json":
          instances = []
          for row in prediction.tolist():
              instances.append({"features": row})
          json_output = {"instances": instances}
  
          return worker.Response(
              json.dumps(json_output), mimetype=accept
          )
      elif accept == "text/csv":
          return worker.Response(
              encoders.encode(prediction, accept), mimetype=accept
          )
      else:
          raise RuntimeException(
              "{} accept type is not supported.".format(accept)
          )
  
file_path: sagemaker-python-sdk/tests/data/sip/sklearn_source_dir/inference.py
imports: from __future__ import print_function
  import sys
  from io import StringIO
  import os
  import csv
  import json
  import numpy
  import pandas
  from sklearn.externals import joblib
  from sagemaker_containers.beta.framework import content_types, encoders, env, modules, transformer, worker
label_desc: Use image node_id 3 for calling a global function with example usage: output_fn(prediction, accept) and returns: worker, worker