code: def target_query(plugin, port, location):
      
      return ((r.row[PLUGIN_NAME_KEY] == plugin) &
              (r.row[PORT_FIELD] == port) &
              (r.row[LOCATION_FIELD] == location))
docs: prepared ReQL for target