<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def connect_serial(port, baud=115200, wait=0):
 """Connect to a MicroPython board via a serial port."""

    if not QUIET:
        print('Connecting to %s (buffer-size %d)...' % (port, BUFFER_SIZE))
    try:
        dev = DeviceSerial(port, baud, wait)
    except DeviceError as err:
        sys.stderr.write(str(err))
        sys.stderr.write('\n')
        return False
    add_device(dev)
    return True