import ast


def update_function_name(func_node, name):
  """
  Update name of function AST
  :param func_node: instance of `ast.FunctionDef`
  :param name: New name of function
  :return: New function node with new name
  """
  return ast.FunctionDef(
    name=name,
    args=func_node.args,
    body=func_node.body,
    decorator_list=func_node.decorator_list if hasattr(func_node, 'decorator_list') else []
  )