input: def optimize_code(code: str) -> str:
      """Takes a given Python function as a string and returns an optimized version of the function.
      
      >>> optimize_code('def getResult(a, b, c): return a + b + c')
      '@dataclass\\nclass Params:\\n a: int\\n b: int\\n c: int\\ndef get_result(params: Params) -> int:\\n """Returns the sum of the three given numbers"""\\n return params.a + params.b + params.c\\n'
      """
output:     import ast
      import astor
  
      class CodeOptimizer(ast.NodeTransformer):
          def visit_FunctionDef(self, node):
              params = [arg.arg for arg in node.args.args]
              param_class_code = f"@dataclass\nclass Params:\n {' '.join([f'{param}: int' for param in params])}\n"
              new_func_name = node.name.replace("getResult", "get_result")
              new_func_code = f"def {new_func_name}(params: Params) -> int:\n    '''Returns the sum of the three given numbers'''\n    return {' + '.join([f'params.{param}' for param in params])}\n"
              return param_class_code + new_func_code
  
      tree = ast.parse(code)
      optimizer = CodeOptimizer()
      optimized_tree = optimizer.visit(tree)
      return astor.to_source(optimized_tree).strip()