def _compose_url(self, url, kwargs):
if url is None:<EOL><INDENT>url = self.url<EOL><DEDENT>if url is None:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>')<EOL><DEDENT>split_result = urisplit(url)<EOL>userinfo = split_result.userinfo<EOL>compose_kwargs = {}<EOL>for key in ['<STR_LIT>', '<STR_LIT:host>', '<STR_LIT:port>', '<STR_LIT:path>', '<STR_LIT>']:<EOL><INDENT>if key in kwargs:<EOL><INDENT>compose_kwargs[key] = kwargs.pop(key)<EOL><DEDENT>else:<EOL><INDENT>compose_kwargs[key] = getattr(split_result, key)<EOL><DEDENT><DEDENT>if '<STR_LIT>' in kwargs:<EOL><INDENT>compose_kwargs['<STR_LIT>'] = kwargs.pop('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>compose_kwargs['<STR_LIT>'] = split_result.query<EOL><DEDENT>if '<STR_LIT>' not in kwargs and userinfo is not None:<EOL><INDENT>kwargs['<STR_LIT>'] = tuple(userinfo.split('<STR_LIT::>', <NUM_LIT:2>))<EOL><DEDENT>return uricompose(**compose_kwargs)<EOL>
Compose a URL starting with the given URL (or self.url if that URL is
None) and using the values in kwargs.

:param str url:
    The base URL to use. If None, ``self.url`` will be used instead.
:param dict kwargs:
    A dictionary of values to override in the base URL. Relevant keys
    will be popped from the dictionary.