def METHOD_NAME():
    # List available serial ports
    serial_ports = [port.device for port in serial.tools.list_ports.comports()]
    if not serial_ports:
        print_message("red", "No serial ports found. Make sure your device is connected and try again.")
        sys.exit(1)
    while True:
        print_message("", "Select the serial port to use:")
        for i, port in enumerate(serial_ports):
            print(f"{i+1}. {port}")
        port_number = input("Enter the number of the serial port to use: ")
        # Check that the user entered a valid number
        if not port_number.isdigit() or not 1 <= int(port_number) <= len(serial_ports):
            print_message("red", f"Invalid port number: {port_number}")
        else:
            return serial_ports[int(port_number)-1]