This type of check should be better done like:

if type(lfns) in types.StringTypes:

In python there are different string types collected in the StringTypes tuple. "lfns" above in principle can be of different type depending how the RM method is called