input: from typing import Callable
  
  def port_code(java_snippet: str) -> Callable:
      """Ports a given Java code snippet to Python 3.
      >>> port_code('public class Foo { public int foo( int a, int b ) { return a + b; } }')
      def foo(a, b): return a + b
      >>> port_code('public class Bar { public int bar( int a ) { return a * 2; } }')
      def bar(a): return a * 2
      """
output:     import re
  
      def parse_java_method(java_snippet):
          method_pattern = re.compile(r'public\s+\w+\s+(\w+)\s*\(([^)]*)\)\s*\{[^}]*return\s+(.*?);')
          match = method_pattern.search(java_snippet)
          if match:
              method_name = match.group(1)
              params = match.group(2).replace('int ', '').split(', ')
              return_expr = match.group(3).replace('a + b', 'a + b').replace('a * 2', 'a * 2')
              return method_name, params, return_expr
          return None, None, None
  
      method_name, params, return_expr = parse_java_method(java_snippet)
      if method_name and params and return_expr:
          param_str = ', '.join(params)
          return eval(f"lambda {param_str}: {return_expr}")
      return None