import textwrap


def wrap_text(text, indent='', maxchars=80):
  """ Wrap the text to the specified number of characters. If
    necessary a line will be broken and wrapped after a word.
    """
  result = ''
  lines = textwrap.wrap(text, maxchars - len(indent))
  for line in lines:
    result += indent + line + '\n'
  return result