def strip_format(msg, flags):
 if (u'python-format' in flags):
  regex = PYTHON_PRINTF_MATCH
 elif (u'python-brace-format' in flags):
  regex = PYTHON_BRACE_MATCH
 elif (u'php-format' in flags):
  regex = PHP_PRINTF_MATCH
 elif (u'c-format' in flags):
  regex = C_PRINTF_MATCH
 elif (u'rst-text' in flags):
  regex = RST_MATCH
 else:
  return msg
 stripped = regex.sub(u'', msg)
 return stripped

def strip_format ( msg , flags ) : if ( u'python-format' in flags ) : regex = PYTHON_PRINTF_MATCH elif ( u'python-brace-format' in flags ) : regex = PYTHON_BRACE_MATCH elif ( u'php-format' in flags ) : regex = PHP_PRINTF_MATCH elif ( u'c-format' in flags ) : regex = C_PRINTF_MATCH elif ( u'rst-text' in flags ) : regex = RST_MATCH else : return msg stripped = regex . sub ( u'' , msg ) return stripped
checks whether given string contains only format strings and possible punctation .