def _format_elemcreate(etype, script=False, *args, **kw):
 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(args[1], script),)
 if script:
  spec = ('{%s}' % spec)
  opts = ' '.join(opts)
 return (spec, opts)

def _format_elemcreate ( etype , script = False , * args , ** kw ) : 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 ( args [ 1 ] , script ) , ) if script : spec = ( '{%s}' % spec ) opts = ' ' . join ( opts ) return ( spec , opts )
formats args and kw according to the given element factory etype .