#NEWLINE# def createSTP( stp_id ) : #NEWLINE# #INDENT# if ( not stp_id . startswith ( URN_NETWORK ) ) : #NEWLINE# #INDENT# raise error . PayloadError ( ( 'STP Id (%s) did not start with %s' % ( stp_id , URN_NETWORK ) ) ) #NEWLINE# #UNINDENT# tsi = stp_id . replace ( URN_NETWORK , '' ) #NEWLINE# if ( '?' in tsi ) : #NEWLINE# #INDENT# ( loc , lbp ) = tsi . split ( '?' ) #NEWLINE# label = parseLabel ( lbp ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# loc = tsi #NEWLINE# label = None #NEWLINE# #UNINDENT# if ( not ( ':' in loc ) ) : #NEWLINE# #INDENT# raise error . PayloadError ( ( 'No : in stp urn (%s)' % loc ) ) #NEWLINE# #UNINDENT# ( network , port ) = loc . rsplit ( ':' , 1 ) #NEWLINE# return nsa . STP ( network , stp_id , label )