def long2str(x):

    """ Convert long integer x to a bytes string.
    """
    l = ( x        & 0xff,
         (x >> 8)  & 0xff,
         (x >> 16) & 0xff,
         (x >> 24) & 0xff)
    return ''.join([chr(x) for x in l])