Nitpick: you can use `if history:` which is clearer, and probably faster.