def removecomment(self, line, origline):
        """Given a line containing a value (can be escaped by ' ' or " ") and possibly a comment
        It returns the tuple (value, comment). A comment will be preceded by # or ;.
        The comment value includes the # or ; if a comment is present - else ''.
        If a line is badly escaped an error is printed using the self.stout object."""
        line=line.strip()
        if line =='':
            self.stout.out("No value in line : \n") 
            self.stout.out(origline+'\n')
            return None
        if line[0] =="'" or line[0] == '"':     #    if the keyword is escaped in quotes
            test = line[1:].find(line[0])
            if  test == -1: # if it starts with a quote but there isn't a second quote in the line
                self.stout.out("Badly formed line in config file(value doesn't have matching quotes): \n") 
                self.stout.out(origline+'\n\n')
                return None, ''
            else:
                value = line[1:test+1]
                comment = line[test+2:].strip()
        else:
            test = line.find('#')
            if test == -1:
                test = line.find(';')
            if test == -1:      
                value = line
                comment = ''
            else:
                value = line[:test]            
                comment = line[test:].strip()
        if comment != '' and comment[0] != ';' and comment[0] != '#':
            self.stout.out("Badly formed line in config file (value or comment incorrectly formed): \n") 
            self.stout.out(origline.strip()+'\n\n')
            return None, ''
        return value, comment
Given a line containing a value (can be escaped by ' ' or " ") and possibly a comment
        It returns the tuple (value, comment). A comment will be preceded by # or ;.
        The comment value includes the # or ; if a comment is present - else ''.
        If a line is badly escaped an error is printed using the self.stout object.
recipes/Python/259175_ConfigObj__Lightweight_Config_File/recipe-259175.py