def openProject(iniFile, projectName, username, password=None):
        """
            Opens and returns the project at the specified location in vss.
            If you pass an absolute path (e.g. a path including the vss separator character '/',
            will attempt to load the project from the exact path specified (adding the root namespace
            declaration '$/' if missing). If this attempt fails (or if you simply pass the name of the project,
            such as 'my project'), will create a new database at the root position and recursively search for the
            specified project.            
            
            Returns a new project node, or 'None', if the search fails. The recursive search is quite
            slow, so pass the full path if you can.
        """
        prName = projectName;
        if projectName.find("/") != -1:
            if not projectName.startswith(VSS_ROOT_FOLDER):
                prName = VSS_ROOT_FOLDER + projectName;
            try:
                vss = com.Dispatch("SourceSafe");
                vss.Open(iniFile, username);
                try:
                    p = vss.VSSItem(prName);
                    return Node(p);
                except: pass
            finally:
                vss = None;
            #out of luck - try stripping out the project name and doing a 'normal' search
            if projectName.endswith("/"):
                prName = projectName.rstrip("/");
            lastSepChar = prName.rfind("/");
            if lastSepChar == -1:
                raise Exception("I Can't be bothered parsing this mess :- put in a proper project name you blithering idiot!");
            prName = prName[lastSepChar, len(prName) - lastSepChar];
            if prName.startswith("/"):
                prName = prName.lstrip("/");
                #todo: all of the above with a nice, clean regex instead.
        ##regular search method:
        toplevels = [];
        db = None;
        try:
            try:
                db = Database();
                db.open(iniFile, username, password);
                #minimum depth search first:            
                for topLevelProj in db:
                    if topLevelProj.name == projectName:
                        return Node(topLevelProj);
                    toplevels.append(topLevelProj);
                #now try increasing the search depth exponentially:
                for proj in toplevels:
                    for child in proj.descendants():
                        if child.name == projectName: return Node(child);
                        else: child.dispose();
                #todo: do this (above) with a list comprehension instead!
            finally:
                db.dispose();
        finally:
            for p in toplevels:
                p.dispose();

            Opens and returns the project at the specified location in vss.
            If you pass an absolute path (e.g. a path including the vss separator character '/',
            will attempt to load the project from the exact path specified (adding the root namespace
            declaration '$/' if missing). If this attempt fails (or if you simply pass the name of the project,
            such as 'my project'), will create a new database at the root position and recursively search for the
            specified project.            
            
            Returns a new project node, or 'None', if the search fails. The recursive search is quite
            slow, so pass the full path if you can.
        
recipes/Python/473884_VSS_Integration_Module/recipe-473884.py