Is there a way to issue “console” commands?

With the entity registry, you can either delete an item, rename the item, or change the entity_id of the item. So if I have an item in the registry called
light.foobar is there someway of pasting to a “console”, or using some python code where you can do something like:

  1. rename(“light.foobar”, “Foo bar”);
  2. rename_id(“light.foobar”, “light.fubar”);
  3. delete(“light.foobar”);