def _hasSubstring(key, text):
 escapedKey = re.escape(key)
 return bool(re.search((('\\W' + escapedKey) + '\\W'), text))

def _hasSubstring ( key , text ) : escapedKey = re . escape ( key ) return bool ( re . search ( ( ( '\\W' + escapedKey ) + '\\W' ) , text ) )
i return true if key is part of text .