code: def _validate_rpc_port(port):
      
      if not port:
          raise NetworkControllerError(desc='Invalid rpc port number.')
      if isinstance(port, str):
          port = int(port)
  
      if port <= 0:
          raise NetworkControllerError(desc='Invalid rpc port number %s' % port)
      return port
docs: Validates give port for use as rpc server port.