def DB(options_, path, bloom_filter_size=10, create_if_missing=False,
       error_if_exists=False, paranoid_checks=False,
       write_buffer_size=(4 * 1024 * 1024), max_open_files=1000,
       block_cache_size=(8 * 1024 * 1024), block_size=163840,
       default_sync=False, default_verify_checksums=False,
       default_fill_cache=True, compressors=(2,)):
    """This is the expected way to open a database. Returns a DBInterface.
    """
    filter_policy = _PointerRef(
        _ldb.leveldb_filterpolicy_create_bloom(bloom_filter_size),
        _ldb.leveldb_filterpolicy_destroy)
    cache = _PointerRef(
        _ldb.leveldb_cache_create_lru(block_cache_size),
        _ldb.leveldb_cache_destroy)

    global options
    options = _ldb.leveldb_options_create()

    # Handling the dual compression in PE 1.2+
    # Since the code on Mojang's side is not compatible with this for now,
    # let fallback to the prior behaviour calling leveldb_options_set_compression
    # with first element in 'compressors'.
    if hasattr(_ldb, 'leveldb_options_set_compressor'):
        log.debug("Found 'leveldb_options_set_compressors' in _ldb")
        if isinstance(compressors, int):
            # Old behaviour, only one compressor
            _ldb.leveldb_options_set_compression(options, compressors)
        elif isinstance(compressors, (list, tuple)):
            # Here we need more than one compressors
            for i, compr in enumerate(compressors):
                if isinstance(compr, int):
                    _ldb.leveldb_options_set_compressor(options, i, compr)
                else:
                    raise TypeError("Wrong type for compressor #%s: int wanted, %s found (%s)." % (i, type(compr), compr))
    else:
        _ldb.leveldb_options_set_compression(options, compressors[0])

    _ldb.leveldb_options_set_filter_policy(
        options, filter_policy.ref)
    _ldb.leveldb_options_set_create_if_missing(options, create_if_missing)
    _ldb.leveldb_options_set_error_if_exists(options, error_if_exists)
    _ldb.leveldb_options_set_paranoid_checks(options, paranoid_checks)
    _ldb.leveldb_options_set_write_buffer_size(options, write_buffer_size)
    _ldb.leveldb_options_set_max_open_files(options, max_open_files)
    _ldb.leveldb_options_set_cache(options, cache.ref)
    _ldb.leveldb_options_set_block_size(options, block_size)

    error = ctypes.POINTER(ctypes.c_char)()
    db = _ldb.leveldb_open(options, path, ctypes.byref(error))
    _ldb.leveldb_options_destroy(options)
    _checkError(error)

    db = _PointerRef(db, _ldb.leveldb_close)
    filter_policy.addReferrer(db)
    cache.addReferrer(db)

    return DBInterface(_LevelDBImpl(db, other_objects=(filter_policy, cache)),
                       allow_close=True, default_sync=default_sync,
                       default_verify_checksums=default_verify_checksums,
                       default_fill_cache=default_fill_cache)
This is the expected way to open a database. Returns a DBInterface.
    
pymclevel/leveldb.py