'Set up the storage system for file-based sessions.
This should only be called once per process; this will be done
automatically when using sessions.init (as the built-in Tool does).'

def setup(cls, **kwargs):

    kwargs['storage_path'] = os.path.abspath(kwargs['storage_path'])
    for (k, v) in kwargs.items():
        setattr(cls, k, v)
    lockfiles = [fname for fname in os.listdir(cls.storage_path) if (fname.startswith(cls.SESSION_PREFIX) and fname.endswith(cls.LOCK_SUFFIX))]
    if lockfiles:
        plural = ('', 's')[(len(lockfiles) > 1)]
        warn(('%s    session    lockfile%s    found    at    startup.    If    you    are    only    running    one    process,    then    you    may    need    to    manually    delete    the    lockfiles    found    at    %r.' % (len(lockfiles), plural, cls.storage_path)))
