import re


def wrap_text(text, lilen=80, indent=""):
    """Wrap text to max lilen length lines"""
    text = text.replace("\n", " ")
    text = text.replace("\t", " ")
    text = " ".join(text.split())
    return ("\n%s" % indent).join(
        line.strip() for line in re.findall(r".{1,%s}(?:\s+|$)" % lilen, text)
    )