code: def sanitize_host(host):
      '''
      Sanitize host string.
      https://tools.ietf.org/html/rfc1123#section-2.1
      '''
      RFC952_characters = ascii_letters + digits + ".-"
      return "".join([c for c in host[0:255] if c in RFC952_characters]f sanitize_host(host):
      '''
      Sanitize host string.
      https://tools.ietf.org/html/rfc1123#section-2.1
      '''
      RFC952_characters = ascii_letters + digits + ".-"
      return "".join([c for c in host[0:255] if c in RFC952_characters])
docs: Sanitize host string.
      https://tools.ietf.org/html/rfc1123#section-2.1