How to chain Python function calls so the behaviour is as follows

I stumbled upon the following problem on a python challenge: Write a function that satisfies the following rule for any number of function calls.

f()()()()()(s) == 'fooooo' + s;

example:

f('it') == 'fit';
f()('x') == 'fox';
f()()('bar') == 'foobar';
f()()()('l') == 'foool';

The function should be stateless and should not use any variables outside the scope.

The function signature was:

def f(s=None):
    # Your code here

I thought that in order to be able to chain multiple calls we will have to return a function when no string is passed into the function, but can't figure out how to build the expected string with no external variables. Suggestions?

def f(s=None):
    if s is None:
        # concatenate an 'o'?
        return f
    else:
        # Last call, return the result str.
        return s


#python

3.35 GEEK