#NEWLINE# def as_choices( self , perm ) : #NEWLINE# #INDENT# '\n        A utility method to convert an integer into a list of integer, string tuples for choices\n        ' #NEWLINE# if ( not isinstance ( perm , int ) ) : #NEWLINE# #INDENT# raise UnknownPermission ( "'perm' must be an integer" ) #NEWLINE# #UNINDENT# result_list = [ ] #NEWLINE# for ( key , val ) in self . items ( ) : #NEWLINE# #INDENT# if ( ( key & perm ) == key ) : #NEWLINE# #INDENT# result_list . append ( ( key , perm ) ) #NEWLINE# #UNINDENT# #UNINDENT# return result_list