class_docstr: EvaluationPlaneHandler is responsible for running arbitrary python scripts.
class_docstr_tok: ["EvaluationPlaneHandler","is","responsible","for","running","arbitrary","python","scripts","."]
code: def _post_impl(self):
      body = json.loads(self.request.body.decode("utf-8"))
      self.logger.log(logging.DEBUG, f"Processing POST request...")
      if "script" not in body:
          self.error_out(400, "Script is empty.")
          return
  
      # Transforming user script into a proper function.
      user_code = body["script"]
      arguments = None
      arguments_str = ""
      if self.arrow_server is not None and "dataPath" in body:
          # arrow flight scenario
          arrow_data = self.get_arrow_data(body["dataPath"])
          if arrow_data is not None:
              arguments = {"_arg1": arrow_data}
      elif "data" in body:
          # legacy scenario
          arguments = body["data"]
  
      if arguments is not None:
          if not isinstance(arguments, dict):
              self.error_out(
                  400,
                  "Script parameters need to be provided as a dictionary.",
              )
              return
          args_in = sorted(arguments.keys())
          n = len(arguments)
          if sorted("_arg" + str(i + 1) for i in range(n)) == args_in:
              arguments_str = ", " + ", ".join(args_in)
          else:
              self.error_out(
                  400,
                  "Variables names should follow "
                  "the format _arg1, _arg2, _argN",
              )
              return
      function_to_evaluate = (
          f"def _user_script(tabpy{arguments_str}):\n"
      )
      for u in user_code.splitlines():
          function_to_evaluate += " " + u + "\n"
  
      self.logger.log(
          logging.INFO, f"function to evaluate={function_to_evaluate}"
      )
  
      try:
          result = yield self._call_subprocess(
              function_to_evaluate, arguments
          )
      except (
          gen.TimeoutError,
          requests.exceptions.ConnectTimeout,
          requests.exceptions.ReadTimeout,
      ):
          self.logger.log(logging.ERROR, self._error_message_timeout)
          self.error_out(408, self._error_message_timeout)
          return
  
      if result is not None:
          if self.arrow_server is not None and "dataPath" in body:
              # arrow flight scenario
              output_data_id = str(uuid.uuid4())
              self.upload_arrow_data(
                  result,
                  output_data_id,
                  {
                      "removeOnDelete": "True",
                      "linkedIDs": body["dataPath"],
                  },
              )
              result = {"outputDataPath": output_data_id}
              self.logger.log(
                  logging.WARN, f"outputDataPath={output_data_id}"
              )
          else:
              if isinstance(result, pandas.DataFrame):
                  result = result.to_dict(orient="list")
          self.write(simplejson.dumps(result, ignore_nan=True))
      else:
          self.write("null")
      self.finish()
  
imports: import pandas
  import pyarrow
  import uuid
  from tabpy.tabpy_server.handlers import BaseHandler
  import json
  import simplejson
  import logging
  from tabpy.tabpy_server.common.util import format_exception
  import requests
  from tornado import gen
  from datetime import timedelta
  from tabpy.tabpy_server.handlers.util import AuthErrorStates
label_desc: Use image node_id 2 for calling the EvaluationPlaneHandler obj's underlying member method code with example usage: obj._post_impl() without return types