Create compile_to_bytecode utility function.

I haven't looked at what lazy imports are supposed to do, therefore I haven't imported the needed items until I know how I'm supposed to import them.
It's probably worth passing mtime=0 and source_size=0 in explicitly here, to match the explicit zeros in the other two cases:

    _code_to_bytecode(code, mtime=0, source_size=0)

(This is important when generating differential updates, as it means that you don't have to ship a bunch of timestamp changes for otherwise-unchanged files)