docs: def valid_hostname(host):
      """
      Returns whether the specified string is a valid hostname.
      """
      if len(host) > 255:
          return False
  
      if host[-1:] == '.':
          host = host[:-1]
  
      return all(_hostname_re.match(c) for c in host.split('.'))