Refactor the call to `_cycles.available_devices` into it's own function and update `self.device` at the same time to avoid mis-matches between `_cycles.available_devices` and `self.device`. Pull Request: https://projects.blender.org/blender/blender/pulls/124079