class_docstr: TabPy application class for keeping context like settings, state, etc.
code: def _build_tabpy_state(self):
      pkg_path = os.path.dirname(tabpy.__file__)
      state_file_dir = self.settings[SettingsParameters.StateFilePath]
      state_file_path = os.path.join(state_file_dir, "state.ini")
      if not os.path.isfile(state_file_path):
          state_file_template_path = os.path.join(
              pkg_path, "tabpy_server", "state.ini.template"
          )
          logger.debug(
              f"File {state_file_path} not found, creating from "
              f"template {state_file_template_path}..."
          )
          shutil.copy(state_file_template_path, state_file_path)
  
      logger.info(f"Loading state from state file {state_file_path}")
      tabpy_state = _get_state_from_file(state_file_dir)
      return tabpy_state, TabPyState(
          config=tabpy_state, settings=self.settings
      )
  
imports: import concurrent.futures
  import configparser
  import logging
  import multiprocessing
  import os
  import shutil
  import signal
  import sys
  import _thread
  import tornado
  from tornado.http1connection import HTTP1Connection
  import tabpy
  import tabpy.tabpy_server.app.arrow_server
  from tabpy.tabpy import __version__
  from tabpy.tabpy_server.app.app_parameters import ConfigParameters, SettingsParameters
  from tabpy.tabpy_server.app.util import parse_pwd_file
  from tabpy.tabpy_server.handlers.basic_auth_server_middleware_factory import BasicAuthServerMiddlewareFactory
  from tabpy.tabpy_server.handlers.no_op_auth_handler import NoOpAuthHandler
  from tabpy.tabpy_server.management.state import TabPyState
  from tabpy.tabpy_server.management.util import _get_state_from_file
  from tabpy.tabpy_server.psws.callbacks import init_model_evaluator, init_ps_server
  from tabpy.tabpy_server.psws.python_service import PythonService, PythonServiceHandler
  from tabpy.tabpy_server.handlers import EndpointHandler, EndpointsHandler, EvaluationPlaneHandler, EvaluationPlaneDisabledHandler, QueryPlaneHandler, ServiceInfoHandler, StatusHandler, UploadDestinationHandler
label_desc: Use image node_id 13 for calling the TabPyApp obj's underlying member method code with example usage: obj._build_tabpy_state() and returns: tabpy_state,  TabPyState