Rough translation of _make_packagename() and _make_imports()