Testing Revit files for families

Yes, node directory.contains works for your purpose:

Also, welcome to the forum and use the search function, it will make your life much easier by learning and asking the right questions.