def date_handler(obj):
    """make datetime object json serializable.

    Notes
    -----
    Taken from here: https://tinyurl.com/yd84fqlw
    """
    if hasattr(obj, 'isoformat'):
        return obj.isoformat()
    else:
        raise TypeError