Switched from recursive to iterative prefix lookup
Optimize emit method

* Reduce logging calls from 2 to 1
* Add short circuit path where there are no registered
  handlers.  This is the common case.
Add unique_id arg to event register/unregister

When registering an event handler, you can now specify any unique
token that represents the identity of that registration.  This
registration is global across all the events registered, and will
prevent any further registrations from happening with the same unique
token.

The design is borrowed from django's dispatcher that has a similar
idea with dispatch_uid.

A sample use case here is for registering events specific to a service
only when a service is created, but ensuring we don't reregister
the event each time the same service object is created (this can
be used for the upcoming retry configuration).
Add unique_id arg to the Session object
Add more comments to event lookups
Merge branch 'event-uid' into develop

* event-uid:
  Add more comments to event lookups
  Add unique_id arg to the Session object
  Add unique_id arg to event register/unregister
  Optimize emit method
  Switched from recursive to iterative prefix lookup