def _get_cluster_by_id(self, cluster_id):
        if cluster_id is None:
            return self.clusters[0]

        for cluster in self.clusters:
            if cluster.id == cluster_id:
                return cluster

        raise Exception(
            'Cluster with ID "{0}" was not found.'.format(cluster_id))
Get cluster by cluster ID.
dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/base.py/EnvironmentManager._get_cluster_by_id