private static Namespace getOrCreateTargetNamespace(Program program, Namespace otherNamespace)
			throws DuplicateNameException, InvalidInputException {
		if (otherNamespace.isGlobal()) {
			return program.getGlobalNamespace();
		}
		Namespace otherParent = otherNamespace.getParentNamespace();
		Namespace parent = getOrCreateTargetNamespace(program, otherParent);

		SymbolTable symbolTable = program.getSymbolTable();
		String otherName = otherNamespace.getName();

		Namespace namespace = symbolTable.getNamespace(otherName, parent);
		if (namespace != null) {
			return namespace;
		}

		// not there, we need to create it.
		SourceType source = otherNamespace.getSymbol().getSource();
		if (otherNamespace instanceof GhidraClass) {
			return symbolTable.createClass(parent, otherName, source);
		}
		else if (otherNamespace instanceof Library) {
			return symbolTable.createExternalLibrary(otherName, source);
		}
		return symbolTable.createNameSpace(parent, otherName, source);
	}
Gets a title string wrapped as HTML and indicating the function's name and the program
containing it.
@param function the function to be indicated in the title.
@return the title string as HTML.
Ghidra/Features/Base/src/main/java/ghidra/program/util/FunctionUtility.java