def check(self, event):
        sender = event.get("sender", None)
        if not sender:
            # Presence events have their 'sender' in content.user_id
            content = event.get("content")
            # account_data has been allowed to have non-dict content, so check type first
            if isinstance(content, dict):
                sender = content.get("user_id")

        return self.check_fields(
            event.get("room_id", None),
            sender,
            event.get("type", None),
        )
Checks if an object is a string, and that it points to a directory.
dataset/ETHPy150Open matrix-org/synapse/synapse/api/filtering.py/Filter.check--crossover with--dataset/ETHPy150Open thisissoon/Flask-Store/flask_store/utils.py/is_directory