Generate url for client with specified route arguments. For the source route '/page/{page_index}'
		this method must be called with 'page_index' parameter (for '3' as 'page_index' parameter result will
		be '/page/3' for 'foo_bar' - '/page/foo_bar'). If 'host', 'protocol' and 'ports' are set as single
		element list or they are passed as method parameters, then absolute link is generated as a result.

		Every parameter in the source pattern must be defined. They can be defined as this method parameters
		or in a constructor. If source pattern has more arguments than it can be resolved, then exception will
		be raised

		:param kwargs: route arguments to use
		:return: str

def url_for(self, **kwargs):
		""" Generate url for client with specified route arguments. For the source route '/page/{page_index}'
		this method must be called with 'page_index' parameter (for '3' as 'page_index' parameter result will
		be '/page/3' for 'foo_bar' - '/page/foo_bar'). If 'host', 'protocol' and 'ports' are set as single
		element list or they are passed as method parameters, then absolute link is generated as a result.

		Every parameter in the source pattern must be defined. They can be defined as this method parameters
		or in a constructor. If source pattern has more arguments than it can be resolved, then exception will
		be raised

		:param kwargs: route arguments to use
		:return: str
		"""
		host = self.virtual_hosts[0] if self.virtual_hosts is not None and len(self.virtual_hosts) == 1 else None
		port = self.ports[0] if self.ports is not None and len(self.ports) == 1 else None
		protocol = self.protocols[0] if self.protocols is not None and len(self.protocols) == 1 else None
		route_args = self.route_args.copy()

		url_args = []
		for key in kwargs.keys():
			if key == 'host':
				host = kwargs['host']
				continue
			if key == 'port':
				port = kwargs['port']
				continue
			if key == 'protocol':
				protocol = kwargs['protocol']
				continue

			url_args.append(key)

		url_prefix = ''
		if protocol is not None and host is not None:
			url_prefix += ('%s://%s' % (protocol, host))
			if port is not None:
				url_prefix += (':%i' % port)

		pattern = self.pattern[1:-1]
		check = lambda x: WWebRoute.pattern_parentheses_removing_re.search(x) is not None or \
			WWebRoute.pattern_parentheses_removing_nested_re.search(x) is not None
		while check(pattern) is True:
			pattern = WWebRoute.pattern_parentheses_removing_re.sub('()', pattern)
			pattern = WWebRoute.pattern_parentheses_removing_nested_re.sub('(())', pattern)

		arg_i = 0
		while WWebRoute.pattern_recombination_re.search(pattern) is not None:
			arg_name = route_args[arg_i]
			arg_value = None
			if arg_name in url_args:
				arg_value = kwargs[arg_name]
			elif arg_name == 'action':
				arg_value = self.action
			elif arg_name in self.presenter_args:
				arg_value = self.presenter_args[arg_name]

			if arg_value is None:
				raise RuntimeError('Invalid argument')

			pattern = WWebRoute.pattern_recombination_re.sub(arg_value, pattern, 1)
			arg_i += 1

		return url_prefix + self.normalize_uri(pattern)