'Function to extract the strings from s3cfg.py'

def parseS3cfg(self, spmod, strings, entry, modlist):

    if isinstance(entry, list):
        id = entry[0]
        value = entry[1]
        if isinstance(value, list):
            parseS3cfg = self.parseS3cfg
            for element in entry:
                parseS3cfg(spmod, strings, element, modlist)
        elif (self.fflag == 1):
            self.func_name = value
            self.fflag = 0
        elif ((token.tok_name[id] == 'NAME') and (value == 'def')):
            self.fflag = 1
        elif ((token.tok_name[id] == 'NAME') and (value == 'T')):
            self.sflag = 1
        elif (self.sflag == 1):
            if (token.tok_name[id] == 'LPAR'):
                self.tflag = 1
                self.bracket = 1
            self.sflag = 0
        elif (self.tflag == 1):
            if (token.tok_name[id] == 'LPAR'):
                self.bracket += 1
                if (self.bracket > 1):
                    self.outstr += '('
            elif (token.tok_name[id] == 'RPAR'):
                self.bracket -= 1
                if (self.bracket > 0):
                    self.outstr += ')'
                else:
                    if (spmod == 'core'):
                        if (('_' not in self.func_name) or (self.func_name.split('_')[1] not in modlist)):
                            strings.append((entry[2], self.outstr))
                    elif (('_' in self.func_name) and (self.func_name.split('_')[1] == spmod)):
                        strings.append((entry[2], self.outstr))
                    self.outstr = ''
                    self.tflag = 0
            elif (self.bracket > 0):
                self.outstr += value
