<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_deploy(self, deploy_values: dict, service_config: dict):
 """Parse deploy key. Args: deploy_values (dict):
 deploy configuration values service_config (dict):
 Service configuration """

        # Initialising empty dictionary
        mode = {}

        for d_value in deploy_values:
            if 'restart_policy' in d_value:
                restart_spec = docker.types.RestartPolicy(
                    **deploy_values[d_value])
                service_config['restart_policy'] = restart_spec
            if 'placement' in d_value:
                for constraints_key, constraints_value in \
                        deploy_values[d_value].items():
                    service_config[constraints_key] = constraints_value
            if 'mode' in d_value:
                mode[d_value] = deploy_values[d_value]
            if 'replicas' in d_value:
                mode[d_value] = deploy_values[d_value]
            if 'resources' in d_value:
                resource_spec = self._parse_resources(
                    deploy_values, d_value)
                service_config['resources'] = resource_spec

        # Setting the types
        mode_spec = docker.types.ServiceMode(**mode)
        service_config['mode'] = mode_spec