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