#NEWLINE# def expand( self , **values ) : #NEWLINE# #INDENT# ' Expand into a URI using the values supplied\n        ' #NEWLINE# if ( self . __template is None ) : #NEWLINE# #INDENT# return URI ( None ) #NEWLINE# #UNINDENT# tokens = self . _tokeniser . split ( self . __template ) #NEWLINE# expander = URITemplate . _Expander ( values ) #NEWLINE# out = [ ] #NEWLINE# while tokens : #NEWLINE# #INDENT# token = tokens . pop ( 0 ) #NEWLINE# if ( token == '{' ) : #NEWLINE# #INDENT# expression = tokens . pop ( 0 ) #NEWLINE# tokens . pop ( 0 ) #NEWLINE# out . append ( expander . expand ( expression ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# out . append ( token ) #NEWLINE# #UNINDENT# #UNINDENT# return URI ( '' . join ( out ) )