Added type check for compatibility with datetime.datetime

Added type check so assert isn't triggered by a datetime.datetime