@classmethod<EOL><INDENT>def from_dict(cls, logical_id, deployment_preference_dict):<DEDENT>
enabled = deployment_preference_dict.get('<STR_LIT>', True)<EOL>if not enabled:<EOL><INDENT>return DeploymentPreference(None, None, None, None, False, None)<EOL><DEDENT>if '<STR_LIT>' not in deployment_preference_dict:<EOL><INDENT>raise InvalidResourceException(logical_id, "<STR_LIT>")<EOL><DEDENT>deployment_type = deployment_preference_dict['<STR_LIT>']<EOL>hooks = deployment_preference_dict.get('<STR_LIT>', dict())<EOL>if not isinstance(hooks, dict):<EOL><INDENT>raise InvalidResourceException(logical_id,<EOL>"<STR_LIT>")<EOL><DEDENT>pre_traffic_hook = hooks.get('<STR_LIT>', None)<EOL>post_traffic_hook = hooks.get('<STR_LIT>', None)<EOL>alarms = deployment_preference_dict.get('<STR_LIT>', None)<EOL>role = deployment_preference_dict.get('<STR_LIT>', None)<EOL>return DeploymentPreference(deployment_type, pre_traffic_hook, post_traffic_hook, alarms, enabled, role)<EOL>
:param logical_id: the logical_id of the resource that owns this deployment preference
:param deployment_preference_dict: the dict object taken from the SAM template
:return: