def hostname_valid(hostname):
 if ((not hostname) or hostname.startswith('localhost') or hostname.endswith('localdomain') or hostname.endswith('novalocal') or (len(hostname.split('.')) < 2)):
  return False
 return True

def hostname_valid ( hostname ) : if ( ( not hostname ) or hostname . startswith ( 'localhost' ) or hostname . endswith ( 'localdomain' ) or hostname . endswith ( 'novalocal' ) or ( len ( hostname . split ( '.' ) ) < 2 ) ) : return False return True
test if specified hostname should be considered valid args: hostname : hostname to test returns: bool: true if valid .