def filter(self, func, name=None):
sl = _SourceLocation(_source_info(), '<STR_LIT>')<EOL>_name = self.topology.graph._requested_name(name, action="<STR_LIT>", func=func)<EOL>stateful = self._determine_statefulness(func)<EOL>op = self.topology.graph.addOperator(self.topology.opnamespace+"<STR_LIT>", func, name=_name, sl=sl, stateful=stateful)<EOL>op.addInputPort(outputPort=self.oport)<EOL>streamsx.topology.schema.StreamSchema._fnop_style(self.oport.schema, op, '<STR_LIT>')<EOL>op._layout(kind='<STR_LIT>', name=_name, orig_name=name)<EOL>oport = op.addOutputPort(schema=self.oport.schema, name=_name)<EOL>return Stream(self.topology, oport)._make_placeable()<EOL>
Filters tuples from this stream using the supplied callable `func`.

For each tuple on the stream ``func(tuple)`` is called, if the return evaluates to ``True`` the
tuple will be present on the returned stream, otherwise the tuple is filtered out.

Args:
    func: Filter callable that takes a single parameter for the tuple.
    name(str): Name of the stream, defaults to a generated name.

If invoking ``func`` for a tuple on the stream raises an exception
then its processing element will terminate. By default the processing
element will automatically restart though tuples may be lost.

If ``func`` is a callable object then it may suppress exceptions
by return a true value from its ``__exit__`` method. When an
exception is suppressed no tuple is submitted to the filtered
stream corresponding to the input tuple that caused the exception.

Returns:
    Stream: A Stream containing tuples that have not been filtered out.