Remove duplicate code (result from duplicate merge)
Move unload_community and database.commit to the stop method.
Properly wait for thread to finish even when multiple threads call stop().
__debug__ flag no longer influences the shutdown behavior.
More debug feedback.
Removing Singleton.

Singletons are used for Dispersy and Database instances.  This is not
stricly necessary and, especially when stopping Dispersy, can be
difficult to deal with.

This patch removes all Singletons from the Dispersy core.

Since Dispersy.{has,get}_instance() can no longer be used to obtain
the Dispersy instance, this instance must be given as parameters when:

- a Community is created (create_community, join_community,
  get_master_members, load_community).

- a Member is created (should now use get_member,
  get_temporary_member_from_id, get_members_from_id, and
  get_member_from_database_id)

Similarly, since DispersyDatabase.{has,get}_instance() can no longer
be used, this should be replaced with dispersy.database.
Unit test cleanup.

Moved all unittests from script.py into their own modules in the tests
directory where nosetests can find them.

The tests no longer use tool/main.py to start and stop dispersy,
instead this is done using setUpClass and tearDownClass in
dispersytestclass.py.
Member cache cleanup.

The member cache moved from the Member class (i.e. it was a global
variable) to the Dispersy instance.

This means that to access the cache, members must be obtained through
one of the Dispersy 'get_member...' methods.
Dispersy.stop() no longer calls Callback.stop().

Callback is created and started before Dispersy is made (in Tribler
this is done in the LaunchManyCore).  It should be stoped after
Dispersy is finished (in Tribler this should also be done in the
LaunchManyCore).