code: def indent(text, prefix):
      
      # Based on Python 3's textwrap.indent
      def prefixed_lines():
          for line in text.splitlines(True):
              yield (prefix + line if line.strip() else line)
      return u"".join(prefixed_lines())
docs: Adds `prefix` to the beginning of non-empty lines in `text`.