def deflate_long(n, add_sign_padding=True):
    "turns a long-int into a normalized byte string (adapted from Crypto.Util.number)"
    # after much testing, this algorithm was deemed to be the fastest
    s = ''
    n = long(n)
    while (n != 0) and (n != -1):
        s = struct.pack('>I', n & 0xffffffffL) + s
        n = n >> 32
    # strip off leading zeros, FFs
    for i in enumerate(s):
        if (n == 0) and (i[1] != '\000'):
            break
        if (n == -1) and (i[1] != '\xff'):
            break
    else:
        # degenerate case, n was either 0 or -1
        i = (0,)
        if n == 0:
            s = '\000'
        else:
            s = '\xff'
    s = s[i[0]:]
    if add_sign_padding:
        if (n == 0) and (ord(s[0]) >= 0x80):
            s = '\x00' + s
        if (n == -1) and (ord(s[0]) < 0x80):
            s = '\xff' + s
    return s
def deflate_long ( n , add_sign_padding = True ) : s = '' n = long ( n ) while ( n != 0 ) and ( n != - 1 ) : s = struct . pack ( '>I' , n & 0xffffffff L ) + s n = n >> 32 for i in enumerate ( s ) : if ( n == 0 ) and ( i [ 1 ] != '\000' ) : break if ( n == - 1 ) and ( i [ 1 ] != '\xff' ) : break else : i = ( 0 , ) if n == 0 : s = '\000' else : s = '\xff' s = s [ i [ 0 ] : ] if add_sign_padding : if ( n == 0 ) and ( ord ( s [ 0 ] ) >= 0x80 ) : s = '\x00' + s if ( n == - 1 ) and ( ord ( s [ 0 ] ) < 0x80 ) : s = '\xff' + s return s
turns a long-int into a normalized byte string (adapted from Crypto.Util.number)