input: Write a function to port a Java code snippet to Python 3. The function should take the Java class definition as input and return the equivalent Python 3 implementation. The input will be a string representing the Java code, and the output should be a string representing the Python code.
  assert port_java_to_python("public class Foo { public int foo( int a, int b ) { return a + b; } }") == "def foo(a, b):\n return a + b"
  assert port_java_to_python("public class Bar { public int bar(int x) { return x * x; } }") == "def bar(x):\n return x * x"
  assert port_java_to_python("public class Baz { public String baz(String s) { return s + \"baz\"; } }") == "def baz(s):\n return s + \"baz\""
output: def port_java_to_python(java_code):
      import re
      match = re.search(r'public\s+\w+\s+(\w+)\s*\(([^)]*)\)\s*\{[^}]*return\s+(.*?);', java_code)
      if match:
          func_name = match.group(1)
          params = match.group(2).replace('int', '').replace('String', '').replace(' ', '').split(',')
          return_expr = match.group(3).strip()
          param_str = ', '.join(params)
          return f"def {func_name}({param_str}):\n return {return_expr}"