looking for a simple renamer tool

I’d like to rename some bones in an armature into something else, which i can define somewhere (in the script).
for example i want to define that if the armature has a bone named upper_arm_L it should be renamed forearm.L and so on.

I would also like to have a similar script for the vertex groups of an object

I assume these kind of utilities exist, but if not, would someone be kind to provide the code here…

Thanks in advance

This simple script does what you want.
But I already solved your specific problem in the add-on I made. :wink: https://blenderartists.org/forum/showthread.php?441851-Rigify-Meta-Rig-for-ManuelbastioniLAB-add-on

import bpy
"""rename bones of an armature or vertex groups of a mesh object with a dictionary of name pairs"""

names = { # "old name" : "new name"
    "Group":"group", # example
    "Bone":"bone", # example

objects = bpy.context.selected_objects
for obj in objects:
    if obj.type == 'ARMATURE':
        for bone in obj.data.bones:
                bone.name = names[bone.name]
    if obj.type == 'MESH':
        for vg in obj.vertex_groups:
                vg.name = names[vg.name]

Thank you :D.
I sterted to look into python programing… so at least I understand how these work.