def sanitize_host(host):
 return ''.join([c for c in host[0:255] if (c in ((ascii_letters + digits) + '.-'))])

def sanitize_host ( host ) : return '' . join ( [ c for c in host [ 0 : 255 ] if ( c in ( ( ascii_letters + digits ) + '.-' ) ) ] )
sanitize host string .