def _unevaluated_Mul(*args):
 args = list(args)
 newargs = []
 ncargs = []
 co = S.One
 while args:
  a = args.pop()
  if a.is_Mul:
   (c, nc) = a.args_cnc()
   args.extend(c)
   if nc:
    ncargs.append(Mul._from_args(nc))
  elif a.is_Number:
   co *= a
  else:
   newargs.append(a)
 _mulsort(newargs)
 if (co is not S.One):
  newargs.insert(0, co)
 if ncargs:
  newargs.append(Mul._from_args(ncargs))
 return Mul._from_args(newargs)

def _unevaluated_Mul ( * args ) : args = list ( args ) newargs = [ ] ncargs = [ ] co = S . One while args : a = args . pop ( ) if a . is_Mul : ( c , nc ) = a . args_cnc ( ) args . extend ( c ) if nc : ncargs . append ( Mul . _from_args ( nc ) ) elif a . is_Number : co *= a else : newargs . append ( a ) _mulsort ( newargs ) if ( co is not S . One ) : newargs . insert ( 0 , co ) if ncargs : newargs . append ( Mul . _from_args ( ncargs ) ) return Mul . _from_args ( newargs )
return a well-formed unevaluated mul: numbers are collected and put in slot 0 .