def build_function(name, args=None, defaults=None, flag=0, doc=None):
 (args, defaults) = ((args or []), (defaults or []))
 func = Function(name, doc)
 func.args = argsnode = Arguments()
 argsnode.args = []
 for arg in args:
  argsnode.args.append(Name())
  argsnode.args[(-1)].name = arg
  argsnode.args[(-1)].parent = argsnode
 argsnode.defaults = []
 for default in defaults:
  argsnode.defaults.append(const_factory(default))
  argsnode.defaults[(-1)].parent = argsnode
 argsnode.kwarg = None
 argsnode.vararg = None
 argsnode.parent = func
 if args:
  register_arguments(func)
 return func

def build_function ( name , args = None , defaults = None , flag = 0 , doc = None ) : ( args , defaults ) = ( ( args or [ ] ) , ( defaults or [ ] ) ) func = Function ( name , doc ) func . args = argsnode = Arguments ( ) argsnode . args = [ ] for arg in args : argsnode . args . append ( Name ( ) ) argsnode . args [ ( - 1 ) ] . name = arg argsnode . args [ ( - 1 ) ] . parent = argsnode argsnode . defaults = [ ] for default in defaults : argsnode . defaults . append ( const_factory ( default ) ) argsnode . defaults [ ( - 1 ) ] . parent = argsnode argsnode . kwarg = None argsnode . vararg = None argsnode . parent = func if args : register_arguments ( func ) return func
create and initialize a astroid function node .