def _port_return_code_to_str (code):
    k = { _widcomm.RFCOMM_SUCCESS : "Success",
          _widcomm.RFCOMM_ALREADY_OPENED : "Port already opened",
          _widcomm.RFCOMM_NOT_OPENED : "Connection not open",
          _widcomm.RFCOMM_HANDLE_ERROR: "This error should never occur " \
                                        "(HANDLE_ERROR) and is a stack bug",
          _widcomm.RFCOMM_LINE_ERR: "Line error",
          _widcomm.RFCOMM_START_FAILED: "Connection attempt failed",
          _widcomm.RFCOMM_PAR_NEG_FAILED: "Parameter negotion (MTU) failed",
          _widcomm.RFCOMM_PORT_NEG_FAILED: "Port negotiation failed",
          _widcomm.RFCOMM_PEER_CONNECTION_FAILED: "Connection ended by remote "\
                                                  "side",
          _widcomm.RFCOMM_PEER_TIMEOUT: "Timeout by remote side",
          _widcomm.RFCOMM_INVALID_PARAMETER: "Invalid parameter",
          _widcomm.RFCOMM_UNKNOWN_ERROR: "Unknown error" }
    if k in code:
        return k[code]
    else:
        return "Invalid RFCOMM error code %s" % str (code)
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/pybluez/bluetooth/widcomm.py/_port_return_code_to_str/swapped operands of `in`