def stripEscapes(s):
 result = ''
 show = 1
 i = 0
 L = len(s)
 while (i < L):
  if ((show == 0) and (s[i] in ANSI_TERMINATORS)):
   show = 1
  elif show:
   n = s.find(ANSI_ESCAPE_BEGIN, i)
   if (n == (-1)):
    return (result + s[i:])
   else:
    result = (result + s[i:n])
    i = n
    show = 0
  i += 1
 return result

def stripEscapes ( s ) : result = '' show = 1 i = 0 L = len ( s ) while ( i < L ) : if ( ( show == 0 ) and ( s [ i ] in ANSI_TERMINATORS ) ) : show = 1 elif show : n = s . find ( ANSI_ESCAPE_BEGIN , i ) if ( n == ( - 1 ) ) : return ( result + s [ i : ] ) else : result = ( result + s [ i : n ] ) i = n show = 0 i += 1 return result
remove all ansi color escapes from the given string .