Bytes doesn't work with %. So append calls to the constructor. Also contruct code with a mutable bytearray and instead of leaving %cs in the code to be replaced by %, leave single bytes which are replaced while traversing jumps