class_docstr: Restrict operations to a single subdirectory - pseudo-chroot
class_docstr_tok: ["Restrict","operations","to","a","single","subdirectory","-","pseudo-chroot"]
code: def _open(self, path, mode="r", *args, **kw):
      if mode not in ("r", "rt", "rb", "rU", "U") and not self._ok(
          path
      ):
          self._violation("open", path, mode, *args, **kw)
      return _open(path, mode, *args, **kw)
  
imports: import os
  import sys
  import tempfile
  import operator
  import functools
  import itertools
  import re
  import contextlib
  import pickle
  import textwrap
  from setuptools.extern import six
  from setuptools.extern.six.moves import builtins, map
  import pkg_resources.py31compat
  from distutils.errors import DistutilsError
  from pkg_resources import working_set
label_desc: Use image node_id 3 for calling the DirectorySandbox obj's underlying member method code with example usage: obj._open(path, mode) and returns: _open