#NEWLINE# def check_cluster_template_usage( cluster_template_id , **kwargs ) : #NEWLINE# #INDENT# users = [ ] #NEWLINE# for cluster in api . get_clusters ( ) : #NEWLINE# #INDENT# if ( cluster_template_id == cluster . cluster_template_id ) : #NEWLINE# #INDENT# users . append ( cluster_template_id . name ) #NEWLINE# #UNINDENT# #UNINDENT# if users : #NEWLINE# #INDENT# raise ex . InvalidReferenceException ( ( _ ( 'Cluster template %(id)s in use by %(clusters)s' ) % { #NEWLINE# #INDENT# 'id' : cluster_template_id , #NEWLINE# 'clusters' : ', ' . join ( users ) , #NEWLINE# #UNINDENT# } ) )