def check_port(user_io, current_port, wizard=False):
    '''detect and get the port the arduino is connected to
    param user_io: UserIO object
    param current_port: the current port, if any
    return: the actual port the arduino was found connected to
    '''
    # Search for arduino port
    port_list = _detect_arduino_port()
    if len(port_list) == 1:
        port = port_list[0]
        if current_port:
            if port != current_port:
                user_io.out.warn("The serial port has changed from %s => %s"
                                 % (current_port, port))
        current_port = port
    elif len(port_list) > 1:
        user_io.out.warn("There could be more than one arduino connected (%s)"
                         % (','.join(port_list)))
        if current_port and current_port not in port_list:
            user_io.out.warn(current_port % "But your port %s is not among them")
            port_list.append(current_port)
        if wizard:
            current_port = user_io.request_option('port',
                                                  default_option=current_port,
                                                  options=port_list,
                                                  one_line_options=True)
        else:
            user_io.out.warn("You might want to run arduino:settings to change it")
    elif len(port_list) == 0:
        user_io.out.error("We can't find an arduino connected")
        if wizard:
            current_port = user_io.request_string('Select port')
        else:
            user_io.out.warn("You might want to run arduino:settings to define port")

    current_port = current_port or 'None'
    user_io.out.writeln("Using arduino port: %s" % current_port, front=Color.GREEN)
    return current_port
dataset/ETHPy150Open biicode/client/dev/hardware/arduino/arduino_port_utils.py/check_port/swapped operands of `%`