def _execute(cur, qry, args=None):
    '''
    Internal wrapper around MySQLdb cursor.execute() function

    MySQLDb does not apply the same filters when arguments are used with the
    query. For example '%' characters on the query must be encoded as '%%' and
    will be restored as '%' when arguments are applied. But when there're no
    arguments the '%%' is not managed. We cannot apply Identifier quoting in a
    predictable way if the query are not always applying the same filters. So
    this wrapper ensure this escape is not made if no arguments are used.
    '''
    if args is None or args == {}:
        qry = qry.replace('%%', '%')
        log.debug('Doing query: %s', qry)
        return cur.execute(qry)
    else:
        log.debug('Doing query: %s args: %s ', qry, repr(args))
        return cur.execute(qry, args)