<s> from neutron . api . rpc . callbacks import exceptions <EOL> from neutron . api . rpc . callbacks import resource_manager <EOL> from neutron . objects import base <EOL> def _get_manager ( ) : <EOL> return resource_manager . ProducerResourceCallbacksManager ( ) <EOL> def provide ( callback , resource_type ) : <EOL> """<STR_LIT>""" <EOL> _get_manager ( ) . register ( callback , resource_type ) <EOL> def unprovide ( callback , resource_type ) : <EOL> """<STR_LIT>""" <EOL> _get_manager ( ) . unregister ( callback , resource_type ) <EOL> def clear ( ) : <EOL> """<STR_LIT>""" <EOL> _get_manager ( ) . clear ( ) <EOL> def pull ( resource_type , resource_id , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> callback = _get_manager ( ) . get_callback ( resource_type ) <EOL> obj = callback ( resource_type , resource_id , ** kwargs ) <EOL> if obj : <EOL> if ( not isinstance ( obj , base . NeutronObject ) or <EOL> resource_type != obj . obj_name ( ) ) : <EOL> raise exceptions . CallbackWrongResourceType ( <EOL> resource_type = resource_type ) <EOL> return obj </s>
