def int32_to_octets(value):
    """ Given an int or long, return a 4-byte array of 8-bit ints."""

    return [int(value >> 24 & 0xFF), int(value >> 16 & 0xFF),
            int(value >> 8 & 0xFF), int(value & 0xFF)]