def build_uri(orig_uriparts, kwargs):
 uriparts = []
 for uripart in orig_uriparts:
  if uripart.startswith(u'_'):
   part = str(kwargs.pop(uripart, uripart))
  else:
   part = uripart
  uriparts.append(part)
 uri = u'/'.join(uriparts)
 id = kwargs.pop(u'id', None)
 if id:
  uri += (u'/%s' % id)
 return uri

def build_uri ( orig_uriparts , kwargs ) : uriparts = [ ] for uripart in orig_uriparts : if uripart . startswith ( u'_' ) : part = str ( kwargs . pop ( uripart , uripart ) ) else : part = uripart uriparts . append ( part ) uri = u'/' . join ( uriparts ) id = kwargs . pop ( u'id' , None ) if id : uri += ( u'/%s' % id ) return uri
build the uri from the original uriparts and kwargs .