Extract import string generation to private method
Extract import string generation to private method

As @trotzig suggested, we can extract this to its own method to keep
the write_imports method smaller and more readable.

trotzig/import-js,flarnie/import-js,lencioni/import-js,lencioni/import-js,Galooshi/import-js,lencioni/import-js,trotzig/import-js,flarnie/import-js,trotzig/import-js