Reorganize imports
Refactor for clarity
Move imports to leader
Refactor _dont_write_bytecode detection
More simply resolve _dont_write_bytecode.