def mod10_to_mod2(dec, length=0):
    """
    Converts decimal number to binary number, represented as list with MSB first, padded if necessary to ensure
    list size is equal to length parameter.
    """
    # Convert dec to a binary string, with <length> leading zeros
    bin_str = format(dec, '0{}b'.format(length))

    # Split that string into array, converting chars to ints
    return [int(b) for b in bin_str]