def long_to_bytes(lnum, padmultiple=1):

    # source: http://stackoverflow.com/a/14527004/1231454

    if lnum == 0:
        return b'\0' * padmultiple
    elif lnum < 0:
        raise ValueError("Can only convert non-negative numbers.")
    s = hex(lnum)[2:]
    s = s.rstrip('L')
    if len(s) & 1:
        s = '0' + s
    s = binascii.unhexlify(s)
    if (padmultiple != 1) and (padmultiple != 0):
        filled_so_far = len(s) % padmultiple
        if filled_so_far != 0:
            s = b'\0' * (padmultiple - filled_so_far) + s
    return s
Iterate over positions in this sequence in reverse order.
dataset/ETHPy150Open simon-weber/gpsoauth/gpsoauth/util.py/long_to_bytes--crossover with--dataset/ETHPy150Open biocore/scikit-bio/skbio/sequence/_sequence.py/Sequence.__reversed__