as far as i know this will not be possible with maya2009. there is support for python scripting there but theres no pyMEL binding. this means you can use python within maya but all the nice bindings that get you access to mayas data aren’t available.
i think pyMel has been introduced with maya2010 but i’m not 100% sure with that
PS: just realized that you can use the maya module to get some access. haven’t used that but i think that will give you access to some of mayas features but the modules shipping with maya2010&maya2011 should give you more possibilities