human
Complete the below
def BaseCookieSessionFactory(serializer, cookie_name='session', max_age=None, path='/', domain=None, secure=False, httponly=False, timeout=1200, reissue_time=0, set_on_exception=True):

    ''''.. versionadded:: 1.5
    Configure a :term:`session factory` which will provide cookie-based
    sessions.  The return value of this function is a :term:`session factory`,
    which may be provided as the ``session_factory`` argument of a
    :class:`pyramid.config.Configurator` constructor, or used as the
    ``session_factory`` argument of the
    :meth:`pyramid.config.Configurator.set_session_factory` method.
    The session factory returned by this function will create sessions
    which are limited to storing fewer than 4000 bytes of data (as the
    payload must fit into a single cookie).
    .. warning:
    This class provides no protection from tampering and is only intended
    to be used by framework authors to create their own cookie-based
    session factories.
    Parameters:
    ``serializer``
    An object with two methods: ``loads`` and ``dumps``.  The ``loads``
    method should accept bytes and return a Python object.  The ``dumps``
    method should accept a Python object and return bytes.  A ``ValueError``
    should be raised for malformed inputs.
    ``cookie_name``
    The name of the cookie used for sessioning. Default: ``\'session\'``.
    ``max_age``
    The maximum age of the cookie used for sessioning (in seconds).
    Default: ``None`` (browser scope).
    ``path``
    The path used for the session cookie. Default: ``\'/\'``.
    ``domain``
    The domain used for the session cookie.  Default: ``None`` (no domain).
    ``secure``
    The \'secure\' flag of the session cookie. Default: ``False``.
    ``httponly``
    Hide the cookie from Javascript by setting the \'HttpOnly\' flag of the
    session cookie. Default: ``False``.
    ``timeout``
    A number of seconds of inactivity before a session times out. If
    ``None`` then the cookie never expires. This lifetime only applies
    to the *value* within the cookie. Meaning that if the cookie expires
    due to a lower ``max_age``, then this setting has no effect.
    Default: ``1200``.
    ``reissue_time``
    The number of...'''

Can you provide a the Python program you requested?
assistant
#Here is the Python program you requested.
    @implementer(ISession)
    class CookieSession(dict, ):
        '    Dictionary-like    session    object    '
        _cookie_name = cookie_name
        _cookie_max_age = (max_age if (max_age is None) else int(max_age))
        _cookie_path = path
        _cookie_domain = domain
        _cookie_secure = secure
        _cookie_httponly = httponly
        _cookie_on_exception = set_on_exception
        _timeout = (timeout if (timeout is None) else int(timeout))
        _reissue_time = (reissue_time if (reissue_time is None) else int(reissue_time))
        _dirty = False
        def __init__(self, request):
            self.request = request
            now = time.time()
            created = renewed = now
            new = True
            value = None
            state = {}
            cookieval = request.cookies.get(self._cookie_name)
            if (cookieval is not None):
                try:
                    value = serializer.loads(bytes_(cookieval))
                except ValueError:
                    value = None
            if (value is not None):
                try:
                    (rval, cval, sval) = value
                    renewed = float(rval)
                    created = float(cval)
                    state = sval
                    new = False
                except (TypeError, ValueError):
                    state = {}
            if (self._timeout is not None):
                if ((now - renewed) > self._timeout):
                    state = {}
            self.created = created
            self.accessed = renewed
            self.renewed = renewed
            self.new = new
            dict.__init__(self, state)
        def changed(self):
            if (not self._dirty):
                self._dirty = True
                def set_cookie_callback(request, response):
                    self._set_cookie(response)
                    self.request = None
                self.request.add_response_callback(set_cookie_callback)
        def invalidate(self):
           ...