Lots of interest here :)
There is also an existing post module that goes from meterpreter/shell -> python/ruby/perl shells (but not meterpreter) here https://github.com/rapid7/metasploit-framework/blob/master/modules/post/multi/manage/system_session.rb