def _wait_for_completion(conn, promise, wait_timeout, msg):
    if not promise:
        return
    wait_timeout = time.time() + wait_timeout
    while wait_timeout > time.time():
        time.sleep(5)
        operation_result = conn.get_request(
            request_id=promise['requestId'],
            status=True)

        if operation_result['metadata']['status'] == "DONE":
            return
        elif operation_result['metadata']['status'] == "FAILED":
            raise Exception(
                'Request failed to complete ' + msg + ' "' + str(
                    promise['requestId']) + '" to complete.')

    raise Exception(
        'Timed out waiting for async operation ' + msg + ' "' + str(
            promise['requestId']
            ) + '" to complete.')
Returns a feature that the pointer is over and which can accept the
dataset/ETHPy150Open saltstack/salt/salt/cloud/clouds/profitbricks.py/_wait_for_completion--crossover with--dataset/ETHPy150Open enthought/pyface/pyface/dock/feature_bar.py/FeatureBar._can_drop_on_feature