Kovid: I found a python-pyphen package which does what's needed for hyphenation. So far it seems to me as easy as:
http://pastebin.com/3tSEsD13
Where do I start? Looking at calibre/src/calibre/gui2/convert/
mobi_output.py it looks to me as a building block for GUI not a part of a code meant to fiddle with ebook text. Also I guess I have to alter the text when converting to AZW3 not MOBI, right?