import string
def find_substring(needle, haystack):
index = haystack.find(needle)
if index == -1:
return False
if index != 0 and haystack[index-1] not in string.whitespace:
return False
L = index + len(needle)
if L < len(haystack) and haystack[L] not in string.whitespace:
return False
return True
string1 = "ADDLESHAW GODDARD"
string2 = "ADDLESHAW GODDARD LLP"
print find_substring(string1, string2)
print find_substring('a', 'a b')
print find_substring('b', 'a b')
string1 = "ADVANCE"
string2 = "ADVANCED BUSINESS EQUIPMENT LTD"
print find_substring(string1, string2)
print find_substring('a', 'ab')
print find_substring('b', 'ab')