<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def open_wallet_search(wallet_handle: int, type_: str, query_json: str, options_json: str) -> int: """ Search for wallet records :param wallet_handle: wallet handler (created by open_wallet). :param type_: allows to separate different record types collections :param query_json: MongoDB style query to wallet record tags: { "tagName": "tagValue", $or: { "tagName2": { $regex: 'pattern' }, "tagName3": { $gte: '123' }, }, } :param options_json: //TODO: FIXME: Think about replacing by bitmask { retrieveRecords: (optional, true by default) If false only "counts" will be calculated, retrieveTotalCount: (optional, false by default) Calculate total count, retrieveType: (optional, false by default) Retrieve record type, retrieveValue: (optional, true by default) Retrieve record value, retrieveTags: (optional, true by default) Retrieve record tags, } :return: search_handle: Wallet search handle that can be used later to fetch records by small batches (with fetch_wallet_search_next_records) """


    logger = logging.getLogger(__name__)
    logger.debug("open_wallet_search: >>> wallet_handle: %r, type_: %r, query_json: %r, options_json: %r",
                 wallet_handle,
                 type_,
                 query_json,
                 options_json)

    if not hasattr(open_wallet_search, "cb"):
        logger.debug("open_wallet_search: Creating callback")
        open_wallet_search.cb = create_cb(CFUNCTYPE(None, c_int32, c_int32, c_int32))

    c_wallet_handle = c_int32(wallet_handle)
    c_type = c_char_p(type_.encode('utf-8'))
    c_query_json = c_char_p(query_json.encode('utf-8'))
    c_options_json = c_char_p(options_json.encode('utf-8'))

    search_handle = await do_call('indy_open_wallet_search',
                                  c_wallet_handle,
                                  c_type,
                                  c_query_json,
                                  c_options_json,
                                  open_wallet_search.cb)
    res = search_handle

    logger.debug("open_wallet_search: <<< res: %r", res)
    return res