def reconstruct_url(self, path_info=None, query_string=None, relative=False):
environ = self.environ<EOL>if relative:<EOL><INDENT>url = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>url = environ['<STR_LIT>'] + '<STR_LIT>'<EOL>if environ.get('<STR_LIT>'):<EOL><INDENT>url += environ['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>url += environ['<STR_LIT>']<EOL>if environ['<STR_LIT>'] == '<STR_LIT>':<EOL><INDENT>if environ['<STR_LIT>'] != '<STR_LIT>':<EOL><INDENT>url += '<STR_LIT::>' + environ['<STR_LIT>']<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if environ['<STR_LIT>'] != '<STR_LIT>':<EOL><INDENT>url += '<STR_LIT::>' + environ['<STR_LIT>']<EOL><DEDENT><DEDENT><DEDENT><DEDENT>url += quote(environ.get('<STR_LIT>', '<STR_LIT>'))<EOL>if path_info is None:<EOL><INDENT>url += quote(environ.get('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>url += path_info<EOL><DEDENT>if query_string is None:<EOL><INDENT>if environ.get('<STR_LIT>'):<EOL><INDENT>url += '<STR_LIT:?>' + environ['<STR_LIT>']<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if query_string:<EOL><INDENT>if isinstance(query_string, str):<EOL><INDENT>url += '<STR_LIT:?>' + query_string<EOL><DEDENT>else:<EOL><INDENT>url += '<STR_LIT:?>' + encode_query_string(query_string)<EOL><DEDENT><DEDENT><DEDENT>return url<EOL>
Reconstructs the request URL using the algorithm provided by PEP3333