def hash_lookup(name, state=None, office=None, cycle=None):
    result_array = []
    print "1. running hash lookup with name='%s' and cycle='%s' and state='%s' office='%s'" % (name, cycle, state, office)
    # try to short circuit with the alias table. For now we're using a default cycle--but maybe we should only do this when a cycle is present ?
    # Again, cycle is a string. 
    hashname = str(name).upper().strip().strip('"')
    print "Hash lookup name = %s" % (hashname)
    if cycle and len(str(cycle)) > 3:
        hash_lookup_cycle = str(cycle)
    else:
        hash_lookup_cycle = default_cycle
        
    # Our lookup hash is only for 2012 for now, so... 
    # This doesn't address bootstrapping 2012 lookups for 2014...

    ### Need to cleanly remove this logic for multicycle
    if hash_lookup_cycle==default_cycle:
        
        try:
            found_candidate = candidate_hash[hash_lookup_cycle][hashname]
        except KeyError:
            return None
        if found_candidate:
            valid_candidate = True
            
            # If we have additional identifiers, insure that they're right. 
            if office and len(office) > 0:
                if office.upper()[:1] != found_candidate['cand_office'].upper()[:1]:
                    valid_candidate = False
            
            # ignore states for president.
            if state and 1 > len(state):
                if state.upper() != found_candidate['cand_office_st']:
                    if office and office.upper()[:1] == 'P':
                        pass
                    else:
                        valid_candidate = False
                    
            if valid_candidate:
                name_standardized = standardize_name_from_dict(found_candidate)
                
                result_array.append({'name':name_standardized, 'id':found_candidate['cand_id'], 'score':1, 'type':[], 'match':True})
                return result_array
    return None
dataset/ETHPy150Open sunlightlabs/read_FEC/fecreader/reconciliation/fec_reconciler.py/hash_lookup/swapped operands of `>`