def normalize_properties(query):
    # properties can use either 'p' or 'pid'; 'pid' seems to be a throwback to freebase and won't be used here. Convert all pid's or p's to keys
    properties = query.get('properties')
    if not properties:
        return None
    newprop_array = []
    for this_prop in properties:
        try:
            this_prop['pid']
            newprop_array.append({this_prop['pid']:this_prop['v']})
        except __HOLE__:
            newprop_array.append({this_prop['p']:this_prop['v']})
            
    #print "properties are: %s" % newprop_array
    return newprop_array
dataset/ETHPy150Open sunlightlabs/read_FEC/fecreader/reconciliation/views.py/normalize_properties