'Internal function.'

def _options(self, cnf, kw=None):

    if kw:
        cnf = _cnfmerge((cnf, kw))
    else:
        cnf = _cnfmerge(cnf)
    res = ()
    for (k, v) in cnf.items():
        if (v is not None):
            if (k[(-1)] == '_'):
                k = k[:(-1)]
            if hasattr(v, '__call__'):
                v = self._register(v)
            elif isinstance(v, (tuple, list)):
                nv = []
                for item in v:
                    if (not isinstance(item, (basestring, int))):
                        break
                    elif isinstance(item, int):
                        nv.append(('%d' % item))
                    else:
                        nv.append((('{%s}' if ('    ' in item) else '%s') % item))
                else:
                    v = '    '.join(nv)
            res = (res + (('-' + k), v))
    return res
