def int_to_le_bytes(value, size=None):
    """Converts an integer to a big-endian sequence of bytes"""
    if size is None:
        size = (value.bit_length() + 7) // 8
    return value.to_bytes(size, 'little')
