I may regret this, but there is a very alpha Python bytecode assembler. https://pypi.python.org/pypi/xasm