class_docstr: Encapsulates a single alert and handles serializing to Dynamo and merging.
class_docstr_tok: ["Encapsulates","a","single","alert","and","handles","serializing","to","Dynamo","and","merging","."]
docstr: Transform a Dynamo record back into an Alert.
  
  Args:
      record (dict): Dynamo item corresponding to a single alert
  
  Returns:
      Alert: An alert with all properties populated from the Dynamo item
  
  Raises:
      AlertCreationError: If the record isn't formatted correctly.
docstr_tok: ["Transform","a","Dynamo","record","back","into","an","Alert",".","Args",":","record","(","dict",")",":","Dynamo","item","corresponding","to","a","single","alert","Returns",":","Alert",":","An","alert","with","all","properties","populated","from","the","Dynamo","item","Raises",":","AlertCreationError",":","If","the","record","is","n't","formatted","correctly","."]
code: def create_from_dynamo_record(cls, record):
      """Transform a Dynamo record back into an Alert.
  
      Args:
          record (dict): Dynamo item corresponding to a single alert
  
      Returns:
          Alert: An alert with all properties populated from the Dynamo item
  
      Raises:
          AlertCreationError: If the record isn't formatted correctly.
      """
      try:
          return cls(
              record["RuleName"],
              json.loads(record["Record"]),
              set(
                  record["Outputs"]
              ),  # In JSON, outputs may be a list - convert back to set
              alert_id=record["AlertID"],
              attempts=record.get("Attempts"),
              cluster=record.get("Cluster"),
              context=record.get("Context"),
              created=datetime.strptime(
                  record["Created"], cls.DATETIME_FORMAT
              ),
              dispatched=datetime.strptime(
                  record["Dispatched"], cls.DATETIME_FORMAT
              )
              if "Dispatched" in record
              else None,
              log_source=record.get("LogSource"),
              log_type=record.get("LogType"),
              merge_by_keys=record.get("MergeByKeys"),
              merge_window=timedelta(
                  minutes=int(record.get("MergeWindowMins", 0))
              ),
              outputs_sent=set(record.get("OutputsSent") or []),
              publishers=record.get("Publishers"),
              rule_description=record.get("RuleDescription"),
              source_entity=record.get("SourceEntity"),
              source_service=record.get("SourceService"),
              staged=record.get("Staged"),
          )
      except (KeyError, TypeError, ValueError) as error:
          raise AlertCreationError(error)
  
imports: from datetime import datetime, timedelta
  import json
  import uuid
  from streamalert.shared import resources, utils
label_desc: Use image node_id 9 for calling the Alert obj's underlying member method code with example usage: obj.create_from_dynamo_record(cls, record) and returns: cls