Large number to many characters
Well, it's not a huge performance improvement, but at least it's a lot cleaner:

def to_chars2(number, length):
    bin_num = bin(number)[2:].zfill(length)
    return ''.join([chr(int(bin_num[s:s+8], 2)) for s in range(0, len(bin_num), 8)])


Benchmarks:

&gt;&gt;&gt; timeit(lambda: to_chars2(4820, 16))
1.590714931488037
&gt;&gt;&gt; timeit(lambda: to_chars(4820, 16))
1.6366891860961914