Removed call to datetime's total_seconds() in favour of a utility
function for compatibility with Python 2.6.
Added tests for expiry using timedeltas.