def _get_or_create_deployment(self, app_name, deployment_name, clear_cache):
        try:
            if deployment_name == '':
                push_deployment_name = 'default'
            else:
                push_deployment_name = deployment_name

            deployment = self.api.read_deployment(
                app_name,
                push_deployment_name)

            if clear_cache:
                self._clear_cache(app_name, deployment_name, deployment)
        except GoneError:
            push_deployment_name = ''
            if deployment_name != '':
                push_deployment_name = deployment_name

            try:
                deployment = self.api.create_deployment(
                    app_name,
                    deployment_name=push_deployment_name)
            except GoneError:
                raise InputErrorException('WrongApplication')
            except ForbiddenError:
                raise InputErrorException('NotAllowed')

        return deployment, push_deployment_name
dataset/ETHPy150Open cloudControl/cctrl/cctrl/app.py/AppController._get_or_create_deployment/original