<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_query_engine(config, clazz):
 """Create and return new query engine object from the given `DBConfig` object. :param config: Database configuration :type config: dbconfig.DBConfig :param clazz: Class to use for creating query engine. Should act like query_engine.QueryEngine. :type clazz: class :return: New query engine """

    try:
        qe = clazz(**config.settings)
    except Exception as err:
        raise CreateQueryEngineError(clazz, config.settings, err)
    return qe