code: def check_for_studio():
      """Helper function to determine if the run environment is studio.
  
      Returns (bool): Returns True if valid Studio request.
  
      Raises:
          NotImplementedError:
              if run environment = Studio and AppType not in STUDIO_APP_TYPES
      """
      is_studio = False
      if os.path.exists("/opt/ml/metadata/resource-metadata.json"):
          with open(
              "/opt/ml/metadata/resource-metadata.json", "r"
          ) as handle:
              metadata = json.load(handle)
          app_type = metadata.get("AppType")
          if app_type:
              # check if the execution is triggered from Studio KernelGateway App
              if app_type in STUDIO_APP_TYPES:
                  is_studio = True
              else:
                  raise NotImplementedError(
                      f"AppType {app_type} in Studio does not support Local Mode."
                  )
          # if no apptype, case of classic notebooks
      return is_studio
  
file_path: sagemaker-python-sdk/src/sagemaker/local/utils.py
imports: from __future__ import absolute_import
  import os
  import logging
  import shutil
  import subprocess
  import json
  import re
  import errno
  from distutils.dir_util import copy_tree
  from six.moves.urllib.parse import urlparse
  from sagemaker import s3
label_desc: Use image node_id 8 for calling a global function with example usage: check_for_studio() and returns: is_studio