I know that Khertan's PyPackager does the icon conversion; perhaps you can peek into his code to see how he does it?
Oh, and while you're there, are you interested in updating it? I've got a few feature requests...