def format_serial()

in firmware/digit-programmer/flash.py [0:0]


def format_serial(serial):
    if not serial.isdigit() or len(serial) > DIGIT_SERIAL_ID_LENGTH:
        _log.error("Serial must be between 1 and 5 characters long.")
        sys.exit(1)
    serial = "D{}".format(serial.rjust(DIGIT_SERIAL_ID_LENGTH, "0"))
    serial = serial.encode("utf-16le")
    return serial