Take the two %
out of this line if '%Notes_SHLs%' in layer.dataSource:
If you want to check if a specific string is within a variable, you need to exclude the %
wildcard symbols
if 'Notes_SHLs' in layer.dataSource:
In response to your comment below, do a print
on that layer.dataSource
rather than the if
to determine what is actually there:
if layer.supports("DATASOURCE"):
print layer.dataSource