<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register_file(self, file, parent, ensure_uniqueness=False):
 """ Registers given file in the Model. :param file: File to register. :type file: unicode :param parent: FileNode parent. :type parent: GraphModelNode :param ensure_uniqueness: Ensure registrar uniqueness. :type ensure_uniqueness: bool :return: FileNode. :rtype: FileNode """


        if ensure_uniqueness:
            if self.get_file_nodes(file):
                raise foundations.exceptions.ProgrammingError("{0} | '{1}' file is already registered!".format(
                    self.__class__.__name__, file))

        LOGGER.debug("> Registering '{0}' file.".format(file))

        row = parent.children_count()
        self.beginInsertRows(self.get_node_index(parent), row, row)
        file_node = FileNode(name=os.path.basename(file),
                             path=file,
                             parent=parent)
        self.endInsertRows()

        self.file_registered.emit(file_node)

        return file_node