This function was taken directly from a file licensed under the EPL. It appears that we must also apply the EPL to any source code taken from such projects: https://www.eclipse.org/legal/eplfaq.php#USEINANOTHER