as @jbweston suggested here https://github.com/python-adaptive/adaptive/pull/232#issuecomment-565614899