Pulled out lock acquiring/release into separate functions.
Pulled out lock acquiring/release into separate functions.

This improves readability, and fixes a flake8 error with complexity

temnoregg/django-mailer,Ubiwhere/django-mailer,spookylukey/django-mailer,pinax/django-mailer,pinax/django-mailer,chriscauley/django-mailer,ryanshawty/django-mailer,jawed123/django-mailer,felixxm/django-mailer