'Checks whether the filter matches the given event fields.
Returns:
bool: True if the event fields match'

def check_fields(self, room_id, sender, event_type, contains_url):

    literal_keys = {'rooms': (lambda v: (room_id == v)), 'senders': (lambda v: (sender == v)), 'types': (lambda v: _matches_wildcard(event_type, v))}
    for (name, match_func) in literal_keys.items():
        not_name = ('not_%s' % (name,))
        disallowed_values = getattr(self, not_name)
        if any(map(match_func, disallowed_values)):
            return False
        allowed_values = getattr(self, name)
        if (allowed_values is not None):
            if (not any(map(match_func, allowed_values))):
                return False
    contains_url_filter = self.filter_json.get('contains_url')
    if (contains_url_filter is not None):
        if (contains_url_filter != contains_url):
            return False
    return True
