def METHOD_NAME(self, update: object) -> Optional[Union[bool, object]]:
    """Determines whether an update should be passed to this handler's :attr:`callback`.
    Args:
        update (:class:`telegram.Update` | :obj:`object`): Incoming update.
    Returns:
        :obj:`bool`
    """
    # pylint: disable=too-many-return-statements
    if isinstance(update, Update) and update.callback_query:
        callback_data = update.callback_query.data
        if self.pattern:
            if callback_data is None:
                return False
            if isinstance(self.pattern, type):
                return isinstance(callback_data, self.pattern)
            if callable(self.pattern):
                return self.pattern(callback_data)
            if not isinstance(callback_data, str):
                return False
            if match := re.match(self.pattern, callback_data):
                return match
        else:
            return True
    return None