defformat(text, indent='', width=70):
out = []
stack = [word for word in text.replace("\n", " ").split(" ") if word]
while stack:
line = []
while stack:
iflen(line) + len(" " + stack[0]) > width:
break
line.append(stack.pop(0))
out.append(indent + " ".join(line))
return"\n".join(out)