Added ``unique_id_uses_count`` to hooks.

This parameter acts like a semaphore/recursive lock for an event with a
unique id such that the event can only be completely removed once the number
of unregister calls to the event equals the number of times it has been
registered.  The unique id event is still only registered once despite multiple
register calls when unique id is used.

cc @jamesls @danielgtaylor 
Does this all need to be under the try/accept for a KeyError.  Generally, you want as small a block as possible when catching exceptions.  Otherwise it's hard to follow which code raised the KeyError.