Unminify a Pythlike String
Haskell, 192 190 187 bytes



unlines.snd.f
f(n:r)|(m,t)&lt;-span(&gt;'9')r,(s,l)&lt;-n#t=(s,n?((n:m):map((' '&lt;$(n:n:m))++)l))
f e=(e,["0"])
'1'?(a:b:r)=(a++drop(length a)b):r
_?s=s
'0'#s=(s,[])
n#s|(r,l)&lt;-f s=(l++)&lt;$&gt;pred n#r


Try it online!

There has to be a better way to handle the arity-1 case, it currently takes up 45 bytes.

Edits:  


-2 bytes by switching to a different method of handling 1, though the previous method has probably more optimization potential.  
-3 bytes by not converting the character digits to numbers and using pred instead of n-1.




unlines.snd.f
f(n:r)|(m,t)&lt;-span(&gt;'9')r,(s,l)&lt;-read[n]#t,w&lt;-map((' '&lt;$(n:n:m))++)=(s,last$((n:m):w l):[(n:m++' ':h):w t|n&lt;'2',h:t&lt;-[l]])
f e=(e,["0"])
0#s=(s,[])
n#s|(r,l)&lt;-f s=(l++)&lt;$&gt;(n-1)#r


Try it online!