docs: def _os_bootstrap():
      """
      Set up 'os' module replacement functions for use during import bootstrap.
      """
  
      global _os_stat, _os_getcwd, _os_environ, _os_listdir
      global _os_path_join, _os_path_dirname, _os_path_basename
      global _os_sep
  
      names = sys.builtin_module_names
  
      join = dirname = environ = listdir = basename = None
      mindirlen = 0
      # Only 'posix' and 'nt' os specific modules are supported.
      # 'dos', 'os2' and 'mac' (MacOS 9) are not supported.
      if 'posix' in names:
          from posix import stat, getcwd, environ, listdir
          sep = _os_sep = '/'
          mindirlen = 1
      elif 'nt' in names:
          from nt import stat, getcwd, environ, listdir
          sep = _os_sep = '\\'
          mindirlen = 3
      else:
          raise ImportError('no os specific module found')
  
      if join is None:
          def join(a, b, sep=sep):
              if a == '':
                  return b
              lastchar = a[-1:]
              if lastchar == '/' or lastchar == sep:
                  return a + b
              return a + sep + b
  
      if dirname is None:
          def dirname(a, sep=sep, mindirlen=mindirlen):
              for i in range(len(a) - 1, -1, -1):
                  c = a[i]
                  if c == '/' or c == sep:
                      if i < mindirlen:
                          return a[:i + 1]
                      return a[:i]
              return ''
  
      if basename is None:
          def basename(p):
              i = p.rfind(sep)
              if i == -1:
                  return p
              else:
                  return p[i + len(sep):]
  
      def _listdir(dir, cache={}):
          # since this function is only used by caseOk, it's fine to cache the
          # results and avoid reading the whole contents of a directory each time
          # we just want to check the case of a filename.
          if not dir in cache:
              cache[dir] = listdir(dir)
          return cache[dir]
  
      _os_stat = stat
      _os_getcwd = getcwd
      _os_path_join = join
      _os_path_dirname = dirname
      _os_environ = environ
      _os_listdir = _listdir
      _os_path_basename = basename