If we absolutely need to check that the type is a string, the preferred method (per [pep8](http://www.python.org/dev/peps/pep-0008/)) is to use isinstance instead of type. However, try/except is [always preferred](docs.python.org/2/glossary.html#term-duck-typing) over type or isinstance. The more pythonic way is to [ask for forgiveness](http://docs.python.org/2/glossary.html#term-eafp) not permission.

Another thing to keep in mind is that maybe expires is a unicode or a byte object and the current check won't properly account for this.