code: def _get_service_port(self, instance):
          
          host = instance.get('host', DEFAULT_HOST)
          port = instance.get('port', DEFAULT_PORT)
          # default port is the name of the service but lookup would fail
          # if the /etc/services file is missing. In that case, fallback to numeric
          try:
              socket.getaddrinfo(host, port)
          except socket.gaierror:
              port = DEFAULT_PORT_NUM
  
          return port
docs: Get the ntp server port