Trying to make shader script only apply to certain objects or materials in BGE

I downloaded a shader to use for 2.79’s game engine to only use on some objects in the scene, but it keeps applying the shader to everything. It’s a very specific issue and I haven’t really been able to find a solution. Basically the shader applies itself to all objects in the scene with these lines near the end:

scene = bge.logic.getCurrentScene()
for obj in scene.objects:
    for mesh in obj.meshes:
        for mat in mesh.materials:
            shader = mat.getShader()
            shader.setSource(VertexShader, FragmentShader, 1)
            shader.setSampler('textureUnit', 0)
            mat.setBlending(bge.logic.BL_SRC_ALPHA, bge.logic.BL_ONE_MINUS_SRC_ALPHA)

I’m trying to make a handful of objects in the scene brighter with different lighting (shadeless or emit), but this script just overrides the settings for everything, so I’m trying to figure out how to exclude certain meshes or materials from it.