code: def dns_encode(x, check_built=False):
      
      if not x or x == b".":
          return b"\x00"
  
      if check_built and b"." not in x and (
          orb(x[-1]) == 0 or (orb(x[-2]) & 0xc0) == 0xc0
      ):
          # The value has already been processed. Do not process it again
          return x
  
      # Truncate chunks that cannot be encoded (more than 63 bytes..)
      x = b"".join(chb(len(y)) + y for y in (k[:63] for k in x.split(b".")))
      if x[-1:] != b"\x00":
          x += b"\x00"
      return x
docs: Encodes a bytes string into the DNS format
  
      :param x: the string
      :param check_built: detect already-built strings and ignore them
      :returns: the encoded bytes string