input: Write a function to port the given Java code snippet to Python 3. The function should take in the Java code as a string and return the equivalent Python code as a string. The function should handle the conversion of class methods from Java to Python.
  assert port_code("public class Foo { public int foo( int a, int b ) { return a + b; } }")=="def foo(a, b):\n return a + b"
  assert port_code("public class Bar { public int bar( int x ) { return x * 2; } }")=="def bar(x):\n return x * 2"
  assert port_code("public class Baz { public void baz() { System.out.println(\"Hello, World!\"); } }")=="def baz():\n print(\"Hello, World!\")"
  assert port_code("")==""
  assert port_code("public class Empty { }")==""
output: def port_code(java_code):
      if not java_code:
          return ""
      import re
      class_pattern = re.compile(r'public class (\w+) { (public .+?) }')
      method_pattern = re.compile(r'public (\w+) (\w+)\((.*?)\) { (.*?) }', re.DOTALL)
      match = class_pattern.search(java_code)
      if not match:
          return ""
      class_name = match.group(1)
      methods = match.group(2)
      method_matches = method_pattern.findall(methods)
      python_methods = []
      for method_match in method_matches:
          return_type, method_name, params, body = method_match
          params = [p.strip().split()[1] for p in params.split(',') if p.strip()]
          body = body.replace('System.out.println', 'print').replace(';', '')
          python_method = f"def {method_name}({', '.join(params)}):\n {body}"
          python_methods.append(python_method)
      return "\n".join(python_methods)