<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def __activation(self, token, branch_memory, matching_memory, is_left=True):
 """ Node activation internal function. This is a generalization of both activation functions. The given token is added or removed from `branch_memory` depending of its tag. For any other data in `matching_memory` the match function will be called and if a match occurs a new token will be produced and sent to all children. """

        if token.is_valid():
            branch_memory.append(token.to_info())
        else:
            with suppress(ValueError):
                branch_memory.remove(token.to_info())

        for other_data, other_context in matching_memory:
            other_context = dict(other_context)
            if is_left:
                left_context = token.context
                right_context = other_context
            else:
                left_context = other_context
                right_context = token.context

            match = self.matcher(left_context, right_context)

            if match:
                MATCH.info("%s (%s | %s) = True",
                           self.__class__.__name__,
                           left_context,
                           right_context)

                newcontext = {k: v for k, v in token.context.items()
                              if isinstance(k, str)}

                for k, v in other_context.items():
                    if not isinstance(k, tuple):
                        # Negated value are not needed any further
                        newcontext[k] = v

                newtoken = Token(token.tag,
                                 token.data | other_data,
                                 newcontext)

                for child in self.children:
                    child.callback(newtoken)
            else:
                MATCH.debug("%s (%s | %s) = False",
                            self.__class__.__name__,
                            left_context,
                            right_context)