code: def namedb_get_last_name_import(cur, name, block_id, vtxindex):
      
      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
docs: Find the last name import for this name