def wrap(prefix, text, cols):
 pad = (' ' * len(prefix.expandtabs()))
 available = (cols - len(pad))
 seq = text.split(' ')
 Nseq = len(seq)
 ind = 0
 lines = []
 while (ind < Nseq):
  lastInd = ind
  ind += get_split_ind(seq[ind:], available)
  lines.append(seq[lastInd:ind])
 ret = ((prefix + ' '.join(lines[0])) + '\n')
 for line in lines[1:]:
  ret += ((pad + ' '.join(line)) + '\n')
 return ret

def wrap ( prefix , text , cols ) : pad = ( ' ' * len ( prefix . expandtabs ( ) ) ) available = ( cols - len ( pad ) ) seq = text . split ( ' ' ) Nseq = len ( seq ) ind = 0 lines = [ ] while ( ind < Nseq ) : lastInd = ind ind += get_split_ind ( seq [ ind : ] , available ) lines . append ( seq [ lastInd : ind ] ) ret = ( ( prefix + ' ' . join ( lines [ 0 ] ) ) + '\n' ) for line in lines [ 1 : ] : ret += ( ( pad + ' ' . join ( line ) ) + '\n' ) return ret
wrap *text* with *prefix* at length *cols* .