def _indentLines(str, indentLevels=1, indentFirstLine=True):
 indent = (_ONE_INDENT * indentLevels)
 lines = str.splitlines(True)
 result = ''
 if ((len(lines) > 0) and (not indentFirstLine)):
  first = 1
  result += lines[0]
 else:
  first = 0
 for line in lines[first:]:
  result += (indent + line)
 return result

def _indentLines ( str , indentLevels = 1 , indentFirstLine = True ) : indent = ( _ONE_INDENT * indentLevels ) lines = str . splitlines ( True ) result = '' if ( ( len ( lines ) > 0 ) and ( not indentFirstLine ) ) : first = 1 result += lines [ 0 ] else : first = 0 for line in lines [ first : ] : result += ( indent + line ) return result
indent all lines in the given string str: input string indentlevels: number of levels of indentation to apply indentfirstline: if false .