def does_match_fields(d, field_match):
    """
    Returns if the given dictionary matches the {field_match}.
    {field_match} may look like: { 'must_be' : 'this', 'and_any_of_' : ['tho', 'se']} """
    if not field_match:
        return True
    for mk, mv in field_match.iteritems(): # each matches must be fulfilled
        val = d[mk]
        if isinstance(mv, list): # any of those values (OR)
            found_any = False;
            for mvv in mv:
                if val == mvv:
                    found_any = True
            if not found_any:
                return False
        else: # or explicitly this one
            if not val == mv:
                return False
    return True