def packl_ctypes(lnum):
    a = ctypes.create_string_buffer(lnum.bit_length() // 8 + 1)
PyLong_AsByteArray(lnum, a, len(a), 0, 1)
return a.raw
Is there a faster way to convert an arbitrary large integer to a big endian sequence of bytes?