input: Write a function to port a Java code snippet to Python 3. The Java code snippet is given below:
  java
  public class Foo {
    public int foo( int a, int b ) {
      return a + b;
    }
  }
  
  The function should return the equivalent Python code.
  
  assert port_java_to_python_3("public class Foo {\n  public int foo( int a, int b ) {\n    return a + b;\n  }\n}")== "def foo(a, b):\n return a + b"
  assert port_java_to_python_3("public class Bar {\n  public int bar( int c ) {\n    return c * c;\n  }\n}")== "def bar(c):\n return c * c"
  assert port_java_to_python_3("")== ""
  
output: def port_java_to_python_3(java_code):
      if not java_code:
          return ""
      lines = java_code.strip().split('\n')
      method_name = lines[1].split()[3].split('(')[0]
      params = lines[1].split('(')[1].split(')')[0].split(', ')
      param_names = [p.split()[-1] for p in params]
      body = lines[2].strip().split()[-1]
      return f"def {method_name}({', '.join(param_names)}):\n return {body}"