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: Find values in the given record that are not in the common subset.
  
  Args:
      common (dict): Common features from _compute_common
      record (dict): Individual record
  
  Returns:
      dict: The record subset whose values differ from the common ones.
  
  Example:
      _compute_diffs(
          {'abc': 123, 'nested': {'A': 1}},  # common
          {'abc': 123, 'nested': {'A': 1, 'B': 2}  # record
      )
      will return {'nested': {'B': 2}}
docstr_tok: ["Find","values","in","the","given","record","that","are","not","in","the","common","subset",".","Args",":","common","(","dict",")",":","Common","features","from","_compute_common","record","(","dict",")",":","Individual","record","Returns",":","dict",":","The","record","subset","whose","values","differ","from","the","common","ones",".","Example",":","_compute_diffs","(","{","'abc","'",":","123",",","'nested","'",":","{","'","A","'",":","1","}","}",",","#","common","{","'abc","'",":","123",",","'nested","'",":","{","'","A","'",":","1",",","'","B","'",":","2","}","#","record",")","will","return","{","'nested","'",":","{","'","B","'",":","2","}","}"]
code: def _compute_diff(cls, common, record):
      """Find values in the given record that are not in the common subset.
  
      Args:
          common (dict): Common features from _compute_common
          record (dict): Individual record
  
      Returns:
          dict: The record subset whose values differ from the common ones.
  
      Example:
          _compute_diffs(
              {'abc': 123, 'nested': {'A': 1}},  # common
              {'abc': 123, 'nested': {'A': 1, 'B': 2}  # record
          )
          will return {'nested': {'B': 2}}
      """
      if not common:
          return record
  
      diff = {}
      for key, val in record.items():
          if key not in common:
              # This key is in the record but not in the common set.
              # Everything in the value is unique to this record.
              diff[key] = val
              continue
  
          if val == common[key]:
              # The record value is identical to the common value - no diffs here.
              continue
  
          if isinstance(val, dict) and isinstance(common[key], dict):
              # The value is a dict which is not entirely in common, but maybe partially so.
              inner_diff = cls._compute_diff(common[key], val)
              if inner_diff:
                  diff[key] = inner_diff
          else:
              # No recursion necessary - this value is definitely not in common.
              diff[key] = val
  
      return diff
  
imports: from datetime import datetime, timedelta
  import json
  import uuid
  from streamalert.shared import resources, utils
label_desc: Use image node_id 14 for calling the Alert obj's underlying member method code with example usage: obj._compute_diff(cls, common, record) and returns: diff, record