public static Symbol createSymbolIfNeeded(Program program, Namespace classNamespace,
			String dataTypeName, Address address, DataApplyOptions applyOptions)
			throws InvalidInputException {

		if (dataTypeName == null || !applyOptions.shouldCreateLabel()) {
			return null;
		}

		// Make sure we have underscores in name
		dataTypeName = SymbolUtilities.replaceInvalidChars(dataTypeName, true);

		SymbolTable symbolTable = program.getSymbolTable();
		SymbolIterator symbols = symbolTable.getSymbolsAsIterator(address);
		for (Symbol symbol : symbols) {
			if (symbol.getName().contains(dataTypeName) &&
				symbol.getParentNamespace().equals(classNamespace)) {
				return null; // Already have one with dataTypeName.
			}
		}

		Symbol symbol =
			symbolTable.createLabel(address, dataTypeName, classNamespace, SourceType.IMPORTED);
		symbol.setPrimary();

		return symbol;
	}
Creates a symbol if one containing the <code>dataTypeName</code> doesn't already exist at 
the specified address in the program.

@param program the program.
@param classNamespace the class Namespace to create the symbol in
@param dataTypeName the dataTypeName to be used in the symbol name.
@param address the address where the symbol should be created in the program.
@param applyOptions options indicating whether or not to apply comments.

@return the symbol or null.

@throws InvalidInputException thrown if symbol can't be created as specified.
Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/EHDataTypeUtilities.java