python2.6 compatibility related.
in py2.6 datetime.timedelta doesnt have total_seconds method.
base64.urlsafe_b64encode doesnt work with bytearray
Merge pull request #4 from mumino/py26_compat

python2.6 compatibility related.