<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def namedb_get_last_name_import(cur, name, block_id, vtxindex):
 """ Find the last name import for this name """

    query = 'SELECT history_data FROM history WHERE history_id = ? AND (block_id < ? OR (block_id = ? AND vtxindex < ?)) ' + \
            'ORDER BY block_id DESC,vtxindex DESC LIMIT 1;'

    args = (name, block_id, block_id, vtxindex)

    history_rows = namedb_query_execute(cur, query, args)

    for row in history_rows:
        history_data = json.loads(row['history_data'])
        return history_data

    return None