code: def lookup_srv(
          domain: bytes,
          service: str,
          transport: str = "tcp",
          **kwargs):
      
  
      record = b".".join([
          b"_" + service.encode("ascii"),
          b"_" + transport.encode("ascii"),
          domain])
  
      answer = yield from repeated_query(
          record,
          dns.rdatatype.SRV,
          **kwargs)
  
      if answer is None:
          return None
  
      items = [
          (rec.priority, rec.weight, (str(rec.target), rec.port))
          for rec in answer
      ]
  
      for i, (prio, weight, (host, port)) in enumerate(items):
          if host == ".":
              raise ValueError(
                  "protocol {!r} over {!r} not supported at {!r}".format(
                      service,
                      transport,
                      domain
                  )
              )
  
          items[i] = (prio, weight, (
              host.rstrip(".").encode("ascii"),
              port))
  
      return items
docs: Query the DNS for SRV records describing how the given `service` over the
      given `transport` is implemented for the given `domain`. `domain` must be
      an IDNA-encoded :class:`bytes` object; `service` must be a normal
      :class:`str`.
  
      Keyword arguments are passed to :func:`repeated_query`.
  
      Return a list of tuples ``(prio, weight, (hostname, port))``, where
      `hostname` is a IDNA-encoded :class:`bytes` object containing the hostname
      obtained from the SRV record. The other fields are also as obtained from
      the SRV records. The trailing dot is stripped from the `hostname`.
  
      If the DNS query returns an empty result, :data:`None` is returned. If any
      of the found SRV records has the root zone (``.``) as `hostname`, this
      indicates that the service is not available at the given `domain` and
      :class:`ValueError` is raised.