Replacing type check by isinstance function