how to modify the gravity center of an object (from a script)

Good morning
I have noticed that every time I create an object, it’s gravity center is (0, 0, 0).
I would like to modify the gravity center to put it where I want.
One solution could be to do setLocation(newGravityCenter) and then modify all the coordinates of the vertices, but it’s quite heavy as solution.
After searching in the object module of the API documentation I found nothing.
Anybody knows a better solution ?

Thank you.

do you mean the pink dot object center? jms has a nice script that emulates the “center new” button by using transformation matrices instead of looping thru all vertices.