@csrf_exempt
def refine_json(request, reconciliation_type):
    
    fuzzy=True
    if reconciliation_type == 'fec_ids':
        pass
    elif reconciliation_type == 'fec_ids_nofuzzy':
        fuzzy=False
    else:
        raise Exception ("Invalid reconciliation type: %s" % (reconciliation_type))
    
    queries = request.REQUEST.get('queries')
    if queries:
        q = json.loads(queries)
        thisjson={}
        if q is not None:
            for key, query in q.iteritems():
                
                state = query.get('state', None)
                office = query.get('office', None)
                cycle = query.get('cycle', None)
                result = run_fec_query(query['query'], state=state, office=office, cycle=cycle, fuzzy=fuzzy)
                thisjson[key] = {'result':result}
        return render_to_json(json.dumps(thisjson))

        
    else:
        message = "Couldn't decode the query JSON!"
        return render_to_json("{'Error':'%s'}" % message)
dataset/ETHPy150Open sunlightlabs/read_FEC/fecreader/reconciliation/views.py/refine_json/original