Anonymize ONLY EU clients' data

I actually want to know if it’s possible to write a function that checks if the IP address is from the EU then the anonymize data setting is enabled? Would it have to be a plugin?

good idea. i would like to run that Plugin/Function as well