def reset_environment(self, expect_http=None, cluster_id=None):
        if self.clusters:
            cluster_id = self._get_cluster_by_id(cluster_id).id
            resp = self.app.put(
                reverse(
                    'ClusterResetHandler',
                    kwargs={'cluster_id': cluster_id}),
                expect_errors=True,
                headers=self.default_headers)
            if expect_http is not None:
                self.tester.assertEqual(resp.status_code, expect_http)
            else:
                # if task was started status code can be either 200 or 202
                # depending on task status
                self.tester.assertIn(resp.status_code, [200, 202])
            if not (200 <= resp.status_code < 400):
                return resp.body
            return self.db.query(Task).filter_by(
                uuid=resp.json_body['uuid']
            ).first()
        else:
            raise NotImplementedError(
                "Nothing to reset - try creating cluster"
            )
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/base.py/EnvironmentManager.reset_environment/original