Is it possible to rename entity_id through a script?

When I add a certain device to my network, it always gets added as switch.foo_bar_1 . Now with customize.yaml, I can give it a friendly name:

switch.foo_bar_1:
  friendly_name: 'Fubar'

What I’d like to be able to do is something similar but to rename the entity_id itself. And to do this from within a file (or script) and not use the GUI. Having to use the UI to rename entities is tedious. Is there a better way?

Something like:

switch.foo_bar_1:
   switch.fubar_1:

Go to Developer Tools > Services and scroll through the list of available service calls. You’ll see there’s no service call to change an entity’s entity_id.

Any ideas on how to achieve this, even if using python_script or appdaemon?

I would also be REALLY interested in this.

Thanks in advance.