#NEWLINE# def _create_resource_instance( self , resource_name , plural_name ) : #NEWLINE# #INDENT# 'Factory function for quota Resource.\n\n        This routine returns a resource instance of the appropriate type\n        according to system configuration.\n\n        If QUOTAS.track_quota_usage is True, and there is a model mapping for\n        the current resource, this function will return an instance of\n        AccountedResource; otherwise an instance of CountableResource.\n        ' #NEWLINE# if ( ( not cfg . CONF . QUOTAS . track_quota_usage ) or ( resource_name not in self . _tracked_resource_mappings ) ) : #NEWLINE# #INDENT# LOG . info ( _LI ( 'Creating instance of CountableResource for resource:%s' ) , resource_name ) #NEWLINE# return resource . CountableResource ( resource_name , resource . _count_resource , ( 'quota_%s' % resource_name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# LOG . info ( _LI ( 'Creating instance of TrackedResource for resource:%s' ) , resource_name ) #NEWLINE# return resource . TrackedResource ( resource_name , self . _tracked_resource_mappings [ resource_name ] , ( 'quota_%s' % resource_name ) )