#NEWLINE# def _coerce_key( self , data ) : #NEWLINE# #INDENT# api_key = data . get ( 'api_key' ) #NEWLINE# permissions_data = data . get ( 'permissions' , [ ] ) #NEWLINE# data = { k : v for ( k , v ) in data . items ( ) if ( k != 'api_key' ) } #NEWLINE# permissions = [ ] #NEWLINE# for permission_data in permissions_data : #NEWLINE# #INDENT# permission = self . _coerce_permission ( permission_data ) #NEWLINE# permissions . append ( permission ) #NEWLINE# #UNINDENT# data [ 'permissions' ] = permissions #NEWLINE# key = Key ( ** data ) #NEWLINE# key . _data [ 'api_key' ] = api_key #NEWLINE# key . _manager = self #NEWLINE# return key