def uint_to_little_endian_bytearray(number, size):
    """Converts an unsigned interger to a little endian bytearray.

    Arguments:
    number -- the number to convert
    size -- the length of the target bytearray
    """
    if number > 2 ** (8 * size) - 1:
        raise ValueError('Integer overflow')
    nle = [0] * size
    for i in range(size):
        nle[i] = number >> i * 8 & 255
    return nle
