code: def detectRtiFromFileName(fileName):
      
      _, extension = os.path.splitext(fileName)
      if os.path.isdir(fileName):
          rtiRegItem = None
          cls = DirectoryRti
      else:
          try:
              rtiRegItem = globalRtiRegistry().getRtiRegItemByExtension(extension)
          except (KeyError):
              logger.debug("No file RTI registered for extension: {}".format(extension))
              rtiRegItem = None
              cls = UnknownFileRti
          else:
              cls = rtiRegItem.getClass(tryImport=True) # cls can be None
  
      return cls, rtiRegItem
docs: Determines the type of RepoTreeItem to use given a file name.
          Uses a DirectoryRti for directories and an UnknownFileRti if the file
          extension doesn't match one of the registered RTI extensions.
  
          Returns (cls, regItem) tuple. Both the cls ond the regItem can be None.
          If the file is a directory, (DirectoryRti, None) is returned.
          If the file extension is not in the registry, (UnknownFileRti, None) is returned.
          If the cls cannot be imported (None, regItem) returned. regItem.exception will be set.
          Otherwise (cls, regItem) will be returned.