It would be clearer to define this function outside as select_first_and_warn, and then specify it as the default for the select parameter.