#NEWLINE# def build_url( self , base_url = None , **kwargs ) : #NEWLINE# #INDENT# "Builds a resource URL for the given kwargs.\n\n        Given an example collection where `collection_key = 'entities'` and\n        `key = 'entity'`, the following URL's could be generated.\n\n        By default, the URL will represent a collection of entities, e.g.::\n\n            /entities\n\n        If kwargs contains an `entity_id`, then the URL will represent a\n        specific member, e.g.::\n\n            /entities/{entity_id}\n\n        :param base_url: if provided, the generated URL will be appended to it\n        " #NEWLINE# url = ( base_url if ( base_url is not None ) else '' ) #NEWLINE# url += ( '/%s' % self . collection_key ) #NEWLINE# entity_id = kwargs . get ( ( '%s_id' % self . key ) ) #NEWLINE# if ( entity_id is not None ) : #NEWLINE# #INDENT# url += ( '/%s' % base_url ) #NEWLINE# #UNINDENT# return url