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

def check(self, event):

    if isinstance(event, UserPresenceState):
        sender = event.user_id
        room_id = None
        ev_type = 'm.presence'
        is_url = False
    else:
        sender = event.get('sender', None)
        if (not sender):
            content = event.get('content')
            if isinstance(content, dict):
                sender = content.get('user_id')
        room_id = event.get('room_id', None)
        ev_type = event.get('type', None)
        is_url = ('url' in event.get('content', {}))
    return self.check_fields(room_id, sender, ev_type, is_url)
