def find_library(library_root, additional_places=None):
    first_guess = ctypes.util.find_library(library_root)
    if first_guess is not None:
        if sys.platform.lower().find("linux") >= 0:
            return sanitize_lib_name(first_guess), None
        elif sys.platform.lower().find("darwin") >= 0:
            return sanitize_lib_name(first_guess), os.path.dirname(first_guess)
        else:
            raise NotImplementedError("Platform %s is not supported" % sys.platform)
    else:
        if sys.platform.lower().find("linux") >= 0:
            possible_locations = os.environ.get("LD_LIBRARY_PATH", "").split(":")
        elif sys.platform.lower().find("darwin") >= 0:
            possible_locations = os.environ.get("DYLD_LIBRARY_PATH", "").split(":")
        else:
            raise NotImplementedError("Platform %s is not supported" % sys.platform)
        if additional_places is not None:
            possible_locations.extend(additional_places)
        library_name = None
        library_dir = None
        for search_path in possible_locations:
            if search_path == "":
                continue
            results = glob.glob(os.path.join(search_path, "lib%s*" % library_root))
            if len(results) >= 1:
                for result in results:
                    if re.match("lib%s[\-_\.]" % library_root, os.path.basename(result)) is None:
                        continue
                    else:
                        library_name = result
                        library_dir = search_path
                        break
            else:
                continue
            if library_name is not None:
                break
        if library_name is None:
            return None, None
        else:
            return sanitize_lib_name(library_name), library_dir