This is the second bootstrap stage. It should be called
    _immediately_ after importing this module the first time. The
    reason behind this process is to allow this module to be inserted
    as a replacement for 'couchbase._libcouchbase' while not loading
    dependencies which depend on that name. The stage2 loads these
    dependencies which ultimately depend on ourselves :)

def _stage2_bootstrap():
    """
    This is the second bootstrap stage. It should be called
    _immediately_ after importing this module the first time. The
    reason behind this process is to allow this module to be inserted
    as a replacement for 'couchbase._libcouchbase' while not loading
    dependencies which depend on that name. The stage2 loads these
    dependencies which ultimately depend on ourselves :)
    """
    from couchbase_ffi.result import (
        Item,
        Result,
        ObserveInfo,
        MultiResult,
        ValueResult,
        OperationResult,
        HttpResult,
        AsyncResult
    )
    from couchbase_ffi.n1ql import _N1QLParams

    globals().update(locals())
    from couchbase_ffi.bucket import Bucket
    globals()['Bucket'] = Bucket

    from couchbase import _bootstrap
    globals()['Transcoder'] = None
    import couchbase.transcoder

    class _Transcoder(couchbase.transcoder.TranscoderPP):
        def _do_json_encode(self, value):
            return PyCBC.json_encode(value)

        def _do_json_decode(self, value):
            return PyCBC.json_decode(value)

        def _do_pickle_encode(self, value):
            return PyCBC.pickle_encode(value)

        def _do_pickle_decode(self, value):
            return PyCBC.pickle_decode(value)

    globals()['Transcoder'] = _Transcoder
    couchbase.transcoder.Transcoder = _Transcoder