private ExternalLocation findMatchingLocationByName(Namespace namespace, String extLabel,
			Address extAddr, boolean reuseExisting) {
		if (StringUtils.isBlank(extLabel)) {
			return null;
		}

		Set<ExternalLocation> externalLocations = getExternalLocations(namespace, extLabel);
		if (externalLocations.isEmpty()) {
			return null;
		}

		if (extAddr != null) {
			// try and find an exact match on address
			for (ExternalLocation externalLocation : externalLocations) {
				if (extAddr.equals(externalLocation.getAddress())) {
					return externalLocation;
				}
			}
			// if reuse existing, return one without an address
			if (reuseExisting) {
				for (ExternalLocation externalLocation : externalLocations) {
					if (externalLocation.getAddress() == null) {
						return externalLocation;
					}
				}
			}
			return null;
		}

		// first look for one without an address
		ExternalLocation possibleExtLoc = null;
		for (ExternalLocation externalLocation : externalLocations) {
			if (externalLocation.getAddress() == null) {
				return externalLocation;
			}
			possibleExtLoc = externalLocation;
		}

		// if reuse existing, then return any
		return reuseExisting ? possibleExtLoc : null;
	}
Get the external location which best matches the specified parameters.
Preference is given to extLabel over extAddr
@param library the library namespace containing this external location.
@param extLabel the name of the external location. Can be null.
@param extAddr the address of function in the external program.  Can be null
@return the best matching ExternalLocation or null.
@throws InvalidInputException if the extLabel name contains illegal characters (i.e. space)
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/external/ExternalManagerDB.java