Python promise implementation