parameters: (stanzas, state, instance)
return_statement: return instance
docstring: Activate a plugin; see Plugin.plugin().
docstring_summary: Activate a plugin; see Plugin.plugin().
docstring_tokens: Activate a plugin ; see Plugin . plugin () .
function: def activate_plugin(stanzas, state, instance):
      """Activate a plugin; see Plugin.plugin()."""
  
      ## Activate stanza handlers
      for (name, event, method) in stanzas[type(instance)]:
          method = getattr(instance, method)
          if not event:
              state.bind_stanza(name, method)
          else:
              state.bind(event, thunk(state.bind_stanza, name, method))
  
      ## Activate event listeners
      for (event, listeners) in instance.EVENTS.iteritems():
          for method in listeners:
              state.bind(event, getattr(instance, method))
  
      return instance
function_tokens: def activate_plugin ( stanzas , state , instance ) : ## Activate stanza handlers for ( name , event , method ) in stanzas [ type ( instance ) ] : method = getattr ( instance , method ) if not event : state . bind_stanza ( name , method ) else : state . bind ( event , thunk ( state . bind_stanza , name , method ) ) ## Activate event listeners for ( event , listeners ) in instance . EVENTS . iteritems ( ) : for method in listeners : state . bind ( event , getattr ( instance , method ) ) return instance