'Adds an additional directory to the search path'

def add_directory(self, directory, with_subdir=False):

    directory = os.path.realpath(directory)
    if (directory is not None):
        if with_subdir:
            directory = os.path.join(directory, self.subdir)
        if (directory not in self._extra_dirs):
            self._extra_dirs.append(directory)
            self._paths = None
