#NEWLINE# def exactly_one( xc , p , contextItem , args ) : #NEWLINE# #INDENT# if ( len ( args ) != 1 ) : #NEWLINE# #INDENT# raise XPathContext . FunctionNumArgs ( ) #NEWLINE# #UNINDENT# if ( len ( args [ 0 ] ) != 1 ) : #NEWLINE# #INDENT# raise XPathContext . FunctionNumArgs ( errCode = 'err:FORG0005' , errText = _ ( 'fn:exactly-one called with a sequence containing zero or more than one item' ) ) #NEWLINE# #UNINDENT# return args [ 0 ]