public static String getDefaultExternalName(SymbolDB sym) {
		if (!(sym instanceof MemorySymbol) && !sym.isExternal()) {
			throw new IllegalArgumentException("External label or function symbol required");
		}

		Address addr = ((MemorySymbol) sym).getExternalProgramAddress();
		if (addr == null) {
			throw new IllegalArgumentException("Default External requires memory address");
		}

		if (sym instanceof FunctionSymbol) {
			return SymbolUtilities.getDefaultExternalFunctionName(addr);
		}

		long dataTypeID = sym.getDataTypeId();
		DataType dt =
			(dataTypeID < 0) ? null : sym.getProgram().getDataTypeManager().getDataType(dataTypeID);
		return SymbolUtilities.getDefaultExternalName(addr, dt);
	}
{@return the default name for an external function or code symbol}
@param sym external label or function symbol
@throws IllegalArgumentException if external label or function symbol not specified or 
external symbol does not have an external program address.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/external/ExternalManagerDB.java