I think you can replace all of this with just `cmp(ap, bp)`, you can compare tuples, even if they have different length:
```
>>> cmp((2012,02,01), (2012,02,01,05))
-1
>>> cmp((2012,02, 01), (2012,01))
1
```
is there any case where this would fail?