class_docstr: Restrict operations to a single subdirectory - pseudo-chroot
class_docstr_tok: ["Restrict","operations","to","a","single","subdirectory","-","pseudo-chroot"]
code: def _ok(self, path):
      active = self._active
      try:
          self._active = False
          realpath = os.path.normcase(os.path.realpath(path))
          return (
              self._exempted(realpath)
              or realpath == self._sandbox
              or realpath.startswith(self._prefix)
          )
      finally:
          self._active = active
  
imports: import os
  import sys
  import tempfile
  import operator
  import functools
  import itertools
  import re
  import contextlib
  import pickle
  import textwrap
  import builtins
  import pkg_resources
  from distutils.errors import DistutilsError
  from pkg_resources import working_set
label_desc: Use image node_id 5 for calling the DirectorySandbox obj's underlying member method code with example usage: obj._ok(path) and returns: unknown