Changes to fix None result from send_messages and others

Hi,

I've made a few changes here:

- The issue I reported is to do with a connection error causing send_messages to return None.  I have added a test for this condition and a fix to skip the count increment if None returned
- send_messages was actually doing "count = backend.send_messages(email_messages)" - i.e for each email sending ALL the email messages, so I have added a test and fixed that
- Weighted choice had an issue where a random value of 1.0 would cause an index out of bounds.  I fixed this, and swapped the weighted choice method with the fast one from http://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/