How to manage vertex group with python?

Hello,

I would like to create a script in blender which would allow, in the vertex groups I created, to:
_delete anything that ends in “.r”
_to copy everything that ends in “.l”
_to replace all “.l_copy” by “.r”
_then apply the “mirror vertex group” function on anything that ends in “.r”

In order to be able to quickly and perfectly mirror the weight of my character.
Does it possible?