You could definitely use python for this, but I would use MEL. If speed was a concern, you would really want to write a plugin using the C++ API.