Autoretry for task

Consider the following task:

    @task(max_retries=5, default_retry_delay=1)
    def div(a, b):
        try:
            return a / b
        except ZeroDivisionError, exc:
            raise div.retry(exc=exc)

If we want to retry task on particular exception, we have to put ugly `try-except`s in all our tasks. The code would be much cleaner, if you can tell Celery to retry task automatically. like so:

    @task_autoretry(max_retries=5, default_retry_delay=1, autoretry_on=ZeroDivisionError)
    def div(a, b):
        return a / b

I wrote decorator for this purpose in my own project, and I decided to share it with you.