moving error emailing function to utils.py to be used by celery beat later