input = (
    "I'm one of the persons' stackoverflow don't th'em said, 'hey what' I'll handle it."
    )
print(re.sub("(?<!s)'(?!(?:t|ll|e?m)\\b)", '"', input))
Replace single quotes with double with exclusion of some elements