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