def validate_port(confvar):
  """
  Validate that the value of confvar is between [0, 65535].
  Returns [(confvar, error_msg)] or []
  """
  port_val = confvar.get()
  error_res = [(confvar, 'Port should be an integer between 0 and 65535 (inclusive).')]
  try:
    port = int(port_val)
    if port < 0 or port > 65535:
      return error_res
  except ValueError:
    return error_res
  return [ ]