from datetime import datetime


def json_datetime(obj):
	"""JSON serializer for datetime objects"""
	if isinstance(obj, (datetime)):
		return obj.isoformat()
	raise TypeError ("Type %s not serializable" % type(obj))