'gets the progress for template deployments'

def _generate_template_progress(self, correlation_id):

    from azure.cli.core.commands.client_factory import get_mgmt_service_client
    from azure.monitor import MonitorClient
    if (correlation_id is not None):
        formatter = 'eventTimestamp    ge    {}'
        end_time = datetime.datetime.utcnow()
        start_time = (end_time - datetime.timedelta(seconds=DEFAULT_QUERY_TIME_RANGE))
        odata_filters = formatter.format(start_time.strftime('%Y-%m-%dT%H:%M:%SZ'))
        odata_filters = "{}    and    {}    eq    '{}'".format(odata_filters, 'correlationId', correlation_id)
        activity_log = get_mgmt_service_client(MonitorClient).activity_logs.list(filter=odata_filters)
        results = []
        max_events = 50
        for (index, item) in enumerate(activity_log):
            if (index < max_events):
                results.append(item)
            else:
                break
        if results:
            for event in results:
                update = False
                long_name = event.resource_id.split('/')[(-1)]
                if (long_name not in self.deploy_dict):
                    self.deploy_dict[long_name] = {}
                    update = True
                deploy_values = self.deploy_dict[long_name]
                checked_values = {str(event.resource_type.value): 'type', str(event.status.value): 'status    value', str(event.event_name.value): 'request'}
                try:
                    checked_values[str(event.properties.get('statusCode', ''))] = 'status'
                except AttributeError:
                    pass
                if ((deploy_values.get('timestamp', None) is None) or (event.event_timestamp > deploy_values.get('timestamp'))):
                    for value in checked_values:
                        if (deploy_values.get(checked_values[value], None) != value):
                            update = True
                        deploy_values[checked_values[value]] = value
                    deploy_values['timestamp'] = event.event_timestamp
                    json_val = deploy_values.copy()
                    json_val.pop('timestamp', None)
                    status_val = deploy_values.get('status    value', None)
                    if (status_val and (status_val != 'Started')):
                        result = ((deploy_values['status    value'] + ':    ') + long_name)
                        result += (('    (' + deploy_values.get('type', '')) + ')')
                        if update:
                            logger.info(result)
