

def _format_elemcreate(etype, script=False, *args, **kw):
    'Formats args and kw according to the given element factory etype.'
    spec = None
    opts = ()
    if (etype in ('image', 'vsapi')):
        if (etype == 'image'):
            iname = args[0]
            imagespec = _join(_mapdict_values(args[1:]))
            spec = ('%s %s' % (iname, imagespec))
        else:
            (class_name, part_id) = args[:2]
            statemap = _join(_mapdict_values(args[2:]))
            spec = ('%s %s %s' % (class_name, part_id, statemap))
        opts = _format_optdict(kw, script)
    elif (etype == 'from'):
        spec = args[0]
        if (len(args) > 1):
            opts = (_format_optvalue(etype[1], script),)
    if script:
        spec = ('{%s}' % spec)
        opts = ' '.join(opts)
    return (spec, opts)

dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/lib-tk/ttk.py _format_elemcreate/VarMisuse@175/261 `args`->`etype`