'Internal function.'

def _grid_configure(self, command, index, cnf, kw):

    if ((type(cnf) is StringType) and (not kw)):
        if (cnf[(-1):] == '_'):
            cnf = cnf[:(-1)]
        if (cnf[:1] != '-'):
            cnf = ('-' + cnf)
        options = (cnf,)
    else:
        options = self._options(cnf, kw)
    if (not options):
        res = self.tk.call('grid', command, self._w, index)
        words = self.tk.splitlist(res)
        dict = {}
        for i in range(0, len(words), 2):
            key = words[i][1:]
            value = words[(i + 1)]
            if (not value):
                value = None
            elif ('.' in value):
                value = getdouble(value)
            else:
                value = getint(value)
            dict[key] = value
        return dict
    else:
        res = self.tk.call((('grid', command, self._w, index) + options))
        if (len(options) == 1):
            if (not res):
                return
            if ('.' in res):
                return getdouble(res)
            return getint(res)
        return
