def matchRecordAttrs(mapobj, attrs):
    """attempt to match given attributes against a single map object's attributes"""
    for k,v in iteritems(attrs):
        try:    val = getattr(mapobj, k)
        except AttributeError:       # k isn't an attr of record
            if bool(v): return False # if k doesn't exist in mapobj but was required, no match
            else:       continue     # otherwise ignore attributes that aren't defined for the given map record
        if val != v:    return False # if any criteria matches, it's considered a match
    return True
def matchRecordAttrs ( mapobj , attrs ) : for k , v in iteritems ( attrs ) : try : val = getattr ( mapobj , k ) except AttributeError : if bool ( v ) : return False else : continue if val != v : return False return True
attempt to match given attributes against a single map object's attributes