def extract_dates(obj):
    if isinstance(obj, dict):
        obj = dict(obj) # don't clobber
        for k,v in obj.items():
            obj[k] = extract_dates(v)
    elif isinstance(obj, (list, tuple)):
        obj = [ extract_dates(o) for o in obj ]
    elif isinstance(obj, str):
        if ISO8601_PAT.match(obj):
            obj = datetime.strptime(obj, ISO8601)
    return obj
extract ISO8601 dates from unpacked JSON
dataset/ETHPy150Open ipython/ipython-py3k/IPython/utils/jsonutil.py/extract_dates