def _get_connection():
    '''
    Global function to access the couchbase connection (and make it if its closed)
    '''
    global COUCHBASE_CONN
    if COUCHBASE_CONN is None:
        opts = _get_options()
        if opts['password']:
            COUCHBASE_CONN = couchbase.Couchbase.connect(host=opts['host'],
                                                         port=opts['port'],
                                                         bucket=opts['bucket'],
                                                         password=opts['password'])
        else:
            COUCHBASE_CONN = couchbase.Couchbase.connect(host=opts['host'],
                                                         port=opts['port'],
                                                         bucket=opts['bucket'])

    return COUCHBASE_CONN