>>> class Pipe:
... def __init__(self, value):
... self.value = value
...
... def __repr__(self):
... return str(self.value)
...
... def __rshift__(self, func):
... self.value = func(self.value)
... return self
>>>
>>> def lower(string):
... return string.lower()
>>>
>>> def strip(string):
... return string.strip()
>>>
>>> def replace(string):
... return string.replace('!', '')
>>>
>>> def capitalize(string):
... return string.capitalize()
>>>
>>>
>>> text = ' Hello World! '
>>>
>>> output = (
... Pipe(text)
... >> strip
... >> lower
... >> replace
... >> capitalize
... )
>>>
>>> print(output)
Hello world