def _apply_icon(app, icon):
    app_path = osx.path_for_app(app)
    if not app_path:
        raise AppMissingError("Application not found: '{0}'".format(app))

    try:
        components = urlparse(icon)
        if not components["scheme"] or components['scheme'] == "file":
            icon_path = components["path"]
        else:
            tmpdir = mkdtemp()
            icon_path = os.path.join(tmpdir,
                                     os.path.basename(components["path"]))
            print(tty.progress("Downloading {0} icon: {1}".format(app, icon)))
            curl(icon, icon_path)
    except __HOLE__:
        icon_path = icon

    osx.set_icon(app_path, os.path.expanduser(icon_path))
dataset/ETHPy150Open msanders/cider/cider/core.py/_apply_icon