What is the idiomatic Python equivalent of this C/C++ code?
void foo() { static int counter = 0; counter++;
Soulution n +=1
def foo(): foo.__dict__.setdefault('count', 0) foo.count += 1 return foo.count