input: Write a function to debug the following Python function `f2` and ensure it correctly calculates and returns the square of the result of `f1(x)`. The function `f1` takes an integer `x` and adds 1 to it, while `f2` calls `f1` twice and multiplies the results. If `f1` is defined correctly, `f2(2)` should output `9`.
  
  assert f2(2)==9
output: def f2(x):
      def f1(x):
          return x + 1
      return f1(f1(x)) ** 2