code: def register_directory(self, directory, parent, ensure_uniqueness=False):
          
  
          if ensure_uniqueness:
              if self.get_directory_nodes(directory):
                  raise foundations.exceptions.ProgrammingError("{0} | '{1}' directory is already registered!".format(
                      self.__class__.__name__, directory))
  
          LOGGER.debug("> Registering '{0}' directory.".format(directory))
  
          row = parent.children_count()
          self.beginInsertRows(self.get_node_index(parent), row, row)
          directory_node = DirectoryNode(name=os.path.basename(directory),
                                         path=directory,
                                         parent=parent)
          self.endInsertRows()
  
          self.directory_registered.emit(directory_node)
  
          return directory_node
docs: Registers given directory in the Model.
  
          :param directory: Directory to register.
          :type directory: unicode
          :param parent: DirectoryNode parent.
          :type parent: GraphModelNode
          :param ensure_uniqueness: Ensure registrar uniqueness.
          :type ensure_uniqueness: bool
          :return: DirectoryNode.
          :rtype: DirectoryNode