There's no method to do run length compression in the python interface level. You can either code the algorithm in C and it will run extremely fast or you can code it in Python and it will run very slow.