code: def mode(self, mode=None):
          
          if mode is None:
              return self.__mode
          if mode == const.MODBUS_TCP or mode == const.MODBUS_RTU:
              self.__mode = mode
              return self.__mode
          else:
              return None
docs: Get or set modbus mode (TCP or RTU)
  
          :param mode: mode (MODBUS_TCP/MODBUS_RTU) to set or None for get value
          :type mode: int
          :returns: mode or None if set fail
          :rtype: int or None