Deadlock restart
> But wouldn't this sort of boilerplate code be better included in peewee itself?

Not in my opinion, no. There are far too many things involved for me to feel comfortable implementing a canonical / library solution to the problem of deadlocks.
 @lucidv01d Did you implement some generic(ish) retry logic or how did you end up tackling it?
I'm running a multi-threaded app with many threads read/writing a central database at the same time. I've wrapped my queries in transactions and have tried to limit their sizes to prevent too many rows from being locked at the same time. However, I still occasionally get **deadlocks**:

`peewee.InternalError: (1213, u'Deadlock found when trying to get lock; try restarting transaction')`

Peewee recommends large bulk inserts as a performance improvement which is contrary to the deadlock solution. The obvious answer to my problem is to **catch this exception and retry the transaction**, which I will do. But wouldn't this sort of boilerplate code be better included **in peewee** itself? Can a feature be added where peewee will automatically retry a deadlocked transaction after waiting a brief amount of time? This feature could be disabled by default if not recommended as best practice, though a lot of mysql newbies would appreciate this sort of thing being handled for them behind the scenes. 
