# Path: cherrypy/_cpcompat.py
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
# def assert_native(n):
# def base64_decode(n, encoding='ISO-8859-1'):
#     def sorted(i):
#     def reversed(x):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def HTTPDate(timeval=None):
#     def unquote_qs(atom, encoding, errors='strict'):
#     def unquote_qs(atom, encoding, errors='strict'):
#         def json_decode(s):
#         def _json_encode(s):
#         def json_encode(value):
#     def random20():
#     def random20():
#     def next(i):
#     def __get_daemon(self):
#     def __set_daemon(self, daemon):
# class SetDaemonProperty:
# 
# Path: cherrypy/lib/lockfile.py
# class LockError(Exception):
# class UnlockError(LockError):
# class LockFile(object):
# class SystemLockFile(object):
# class WindowsLockFile(SystemLockFile):
# class UnixLockFile(SystemLockFile):
#     def __init__(self, path):
#     def __init__(self, path):
#     def release(self):
#     def remove(self):
#     def __init__(self, path):
#     def release(self):
#     def remove(self):
#     def _unlock_file(self):
#     def _lock_file(self):
#     def _unlock_file(self):
#     def _lock_file(self):


import sys
import datetime
import os
import time
import threading
import types
import cherrypy
        import memcache
from cherrypy._cpcompat import copyitems, pickle, random20, unicodestr
from cherrypy.lib import httputil
from cherrypy.lib import lockfile
                f.close()
        except (IOError, EOFError):
            e = sys.exc_info()[1]
            if self.debug:
                cherrypy.log("Error loading the session pickle: %s" % e, 'TOOLS.SESSIONS')
            return None

    def _save(self, expiration_time):
        assert self.locked, "The session was saved without being locked.  Check your tools' priority levels."
        f = open(self._get_file_path(), "wb")
        try:
            pickle.dump((self._data, expiration_time), f, self.pickle_protocol)
        finally:
            f.close()

    def _delete(self):
        assert self.locked, "The session deletion without being locked.  Check your tools' priority levels."
        try:
            os.unlink(self._get_file_path())
        except OSError:
            pass

    def acquire_lock(self, path=None):
        """Acquire an exclusive lock on the currently-loaded session data."""
        if path is None:
            path = self._get_file_path()
        path += self.LOCK_SUFFIX
        while True:
            try:
                self.lock = lockfile.LockFile(path)

# Path: cherrypy/_cpcompat.py
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
#     def ntob(n, encoding='ISO-8859-1'):
#     def ntou(n, encoding='ISO-8859-1'):
#     def tonative(n, encoding='ISO-8859-1'):
# def assert_native(n):
# def base64_decode(n, encoding='ISO-8859-1'):
#     def sorted(i):
#     def reversed(x):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def get_daemon(t):
#     def set_daemon(t, val):
#     def HTTPDate(timeval=None):
#     def unquote_qs(atom, encoding, errors='strict'):
#     def unquote_qs(atom, encoding, errors='strict'):
#         def json_decode(s):
#         def _json_encode(s):
#         def json_encode(value):
#     def random20():
#     def random20():
#     def next(i):
#     def __get_daemon(self):
#     def __set_daemon(self, daemon):
# class SetDaemonProperty:
# 
# Path: cherrypy/lib/lockfile.py
# class LockError(Exception):
# class UnlockError(LockError):
# class LockFile(object):
# class SystemLockFile(object):
# class WindowsLockFile(SystemLockFile):
# class UnixLockFile(SystemLockFile):
#     def __init__(self, path):
#     def __init__(self, path):
#     def release(self):
#     def remove(self):
#     def __init__(self, path):
#     def release(self):
#     def remove(self):
#     def _unlock_file(self):
#     def _lock_file(self):
#     def _unlock_file(self):
#     def _lock_file(self):


# Path: cherrypy/lib/sessions.py
import sys
import datetime
import os
import time
import threading
import types
import cherrypy
        import memcache
from cherrypy._cpcompat import copyitems, pickle, random20, unicodestr
from cherrypy.lib import httputil
from cherrypy.lib import lockfile

                f.close()
        except (IOError, EOFError):
            e = sys.exc_info()[1]
            if self.debug:
                cherrypy.log("Error loading the session pickle: %s" % e, 'TOOLS.SESSIONS')
            return None

    def _save(self, expiration_time):
        assert self.locked, "The session was saved without being locked.  Check your tools' priority levels."
        f = open(self._get_file_path(), "wb")
        try:
            pickle.dump((self._data, expiration_time), f, self.pickle_protocol)
        finally:
            f.close()

    def _delete(self):
        assert self.locked, "The session deletion without being locked.  Check your tools' priority levels."
        try:
            os.unlink(self._get_file_path())
        except OSError:
            pass

    def acquire_lock(self, path=None):
        """Acquire an exclusive lock on the currently-loaded session data."""
        if path is None:
            path = self._get_file_path()
        path += self.LOCK_SUFFIX
        while True:
            try:
                self.lock = lockfile.LockFile(path)

            except lockfile.LockError: