

def squash_dates(obj):
    'squash datetime objects into ISO8601 strings'
    if isinstance(o, dict):
        obj = dict(obj)
        for (k, v) in obj.items():
            obj[k] = squash_dates(v)
    elif isinstance(obj, (list, tuple)):
        obj = [squash_dates(o) for o in obj]
    elif isinstance(obj, datetime):
        obj = obj.strftime(ISO8601)
    return obj

dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/jsonutil.py squash_dates/VarMisuse@15/32 `obj`->`o`