code: def build_function(name, args=None, defaults=None, doc=None):
      
      args, defaults = args or [], defaults or []
      # first argument is now a list of decorators
      func = nodes.FunctionDef(name, doc)
      func.args = argsnode = nodes.Arguments()
      argsnode.args = []
      for arg in args:
          argsnode.args.append(nodes.Name())
          argsnode.args[-1].name = arg
          argsnode.args[-1].parent = argsnode
      argsnode.defaults = []
      for default in defaults:
          argsnode.defaults.append(nodes.const_factory(default))
          argsnode.defaults[-1].parent = argsnode
      argsnode.kwarg = None
      argsnode.vararg = None
      argsnode.parent = func
      if args:
          register_arguments(func)
      return func
docs: create and initialize an astroid FunctionDef node