def _apply_rules(name, rules):
 if ('nofqdn' in rules):
  name = name.split('.', 1)[0]
 if ('lower' in rules):
  name = name.lower()
 return name

def _apply_rules ( name , rules ) : if ( 'nofqdn' in rules ) : name = name . split ( '.' , 1 ) [ 0 ] if ( 'lower' in rules ) : name = name . lower ( ) return name
apply rules on the objects names .