In the UI, a common pattern was to check if a query was prefixed by an assignment and in that case, assign the result to the given name. This function puts this in a common place, so it can be used from all the parts where it is needed.