def matchvalue(self, value, param):
        """Given a value from a config file it checks that it is of the type sepcified in param.
        This will either be a string (param ='', value = anything !) or multiple strings
        (param = '[]', value=['any thing',"any thing",anything,.....]).
        It returns None (invalid value), a string, or a list of strings."""
        if value == '':
            if param == '[]':
                return None
            else:
                return ''
        if param == '[]':
            value=value.strip()
            if value[0] != '[' or value[-1] != ']':
                return None
            value = value[1:-1]
            newvals=[]
            value=value.lstrip()
            while len(value) > 0:                
                if value[0] == '\'' or value[0] == '"':
                    test = value[1:].find(value[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( a value doesn't have matching quotes): \n") 
#                        self.stout.out(origline+'\n')      # this error is also handled when matchvalue returns None
                        return None
                    else:
                        newvals.append(value[1:test+1])
                        value = value[test+2:].lstrip()
                        if value[0] == ',':
                            value = value[1:]
                            value=value.lstrip()
                else:
                    test=value.find(',')
                    if test != -1:
                        newvals.append(value[:test])
                        value = value[test+1:].lstrip()
                    else:
                        newvals.append(value)
                        value = ''
            return newvals
        if value[0] =='[':
            return None

        if value[0] == '\'' or value[0] == '"':
            test = value[1:].find(value[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( a value doesn't have matching quotes): \n") 
                self.stout.out(origline+'\n')
                return None
            else:
                return value[1:test+1]
        else:
            return value.strip()
Given a value from a config file it checks that it is of the type sepcified in param.
        This will either be a string (param ='', value = anything !) or multiple strings
        (param = '[]', value=['any thing',"any thing",anything,.....]).
        It returns None (invalid value), a string, or a list of strings.
recipes/Python/259175_ConfigObj__Lightweight_Config_File/recipe-259175.py