docs: def names2dnsrepr(x):
      """
      Take as input a list of DNS names or a single DNS name
      and encode it in DNS format (with possible compression)
      If a string that is already a DNS name in DNS format
      is passed, it is returned unmodified. Result is a string.
      !!!  At the moment, compression is not implemented  !!!
      """
  
      if isinstance(x, bytes):
          if x and x[-1:] == b'\x00':  # stupid heuristic
              return x
          x = [x]
  
      res = []
      for n in x:
          termin = b"\x00"
          if n.count(b'.') == 0:  # single-component gets one more
              termin += b'\x00'
          n = b"".join(chb(len(y)) + y for y in n.split(b'.')) + termin
          res.append(n)
      return b"".join(res)