#NEWLINE# def fn_round_half_to_even( xc , p , contextItem , args ) : #NEWLINE# #INDENT# if ( ( len ( args ) > 2 ) or ( len ( args ) == 0 ) ) : #NEWLINE# #INDENT# raise XPathContext . FunctionNumArgs ( ) #NEWLINE# #UNINDENT# x = numericArg ( xc , p , args ) #NEWLINE# if ( len ( args ) == 2 ) : #NEWLINE# #INDENT# precision = args [ 1 ] #NEWLINE# if ( ( len ( precision ) != 1 ) or ( not isinstance ( precision [ 0 ] , _INT_TYPES ) ) ) : #NEWLINE# #INDENT# raise XPathContext . FunctionArgType ( 2 , 'integer' ) #NEWLINE# #UNINDENT# precision = precision [ 0 ] #NEWLINE# return round ( x , precision ) #NEWLINE# #UNINDENT# return round ( x )