def convert_to_4(self):
from six.moves.urllib import parse<EOL>if not self.config.has_section('<STR_LIT>'):<EOL><INDENT>self.config.add_section('<STR_LIT>')<EOL><DEDENT>site = parse.urlparse(self.get('<STR_LIT>', default_value='<STR_LIT>'))<EOL>backend_uri = '<STR_LIT>'.format(<EOL>username=self.get('<STR_LIT:username>', default_value='<STR_LIT>'),<EOL>password=parse.quote(self.get('<STR_LIT:password>', default_value='<STR_LIT>'),<EOL>safe='<STR_LIT>'),<EOL>hostname=site.hostname<EOL>)<EOL>self.config.set('<STR_LIT>', '<STR_LIT:default>', backend_uri)<EOL>self.config.remove_option('<STR_LIT:default>', '<STR_LIT:username>')<EOL>self.config.remove_option('<STR_LIT:default>', '<STR_LIT:password>')<EOL>self.config.remove_option('<STR_LIT:default>', '<STR_LIT>')<EOL>if not self.config.has_section('<STR_LIT>'):<EOL><INDENT>self.config.add_section('<STR_LIT>')<EOL><DEDENT>if not self.config.has_section('<STR_LIT>'):<EOL><INDENT>self.config.add_section('<STR_LIT>')<EOL><DEDENT>if self.config.has_section('<STR_LIT>'):<EOL><INDENT>for alias, mapping in self.config.items('<STR_LIT>'):<EOL><INDENT>self.config.set('<STR_LIT>', alias, mapping)<EOL><DEDENT>self.config.remove_section('<STR_LIT>')<EOL><DEDENT>if self.config.has_section('<STR_LIT>'):<EOL><INDENT>for alias, mapping in self.config.items('<STR_LIT>'):<EOL><INDENT>self.config.set('<STR_LIT>', alias, mapping)<EOL><DEDENT>self.config.remove_section('<STR_LIT>')<EOL><DEDENT>
Convert a pre-4.0 configuration file to a 4.0 configuration file.