code: def connect(remote_host):
      
      if remote_host in ('master', 'server'):
          remote_host = nago.settings.get_option('server')
      node = nago.core.get_node(remote_host)
      if not node:
          try:
              address = socket.gethostbyname(remote_host)
              node = nago.core.Node()
              node['host_name'] = remote_host
              node['address'] = address
              node['access'] = 'node'
              if token_or_hostname == nago.settings.get_option('server'):
                  node['access'] = 'master'
              node.save()
          except Exception:
              raise Exception("'%s' was not found in list of known hosts, and does not resolve to a valid address" % remote_host)
      ping_result = node.send_command('nodes', 'ping')
      if 'Pong' in ping_result.get('result', ''):
          return "Connection with %s ok" % remote_host
      else:
          return ping_result.get('result', ping_result)
docs: Connect to remote host and show our status