Check if indices values in `Dataset.select` are within bounds
Fix #3707 

Instead of reusing `_check_valid_index_key` from `datasets.formatting`, I defined a new function to provide a more meaningful error message.
