class_docstr: ArtifactExtractor class will extract artifacts from "streamalert_normalization" field in the
  records. The extracted artfiacts will be saved in the S3 bucket via a dedicated Firehose
  delivery stream and searchable from "artifacts" table in Athena.
docstr: Extract all artifacts from a record
  
  Returns:
      list: A list of Artifacts from a normalized record.
  
  normalized information in the record will be similar to
  {
      'record': {
          'region': 'us-east-1',
          'detail': {
              'awsRegion': 'us-west-2'
          }
      },
      'streamalert_normalization': {
          'region': [
              {
                  'values': ['region_name'],
                  'function': 'AWS region'
              },
              {
                  'values': ['region_name'],
                  'function': 'AWS region',
                  'send_to_artifacts': False
              }
          ]
      }
  }
docstr_tok: ["Extract","all","artifacts","from","a","record","Returns",":","list",":","A","list","of","Artifacts","from","a","normalized","record",".","normalized","information","in","the","record","will","be","similar","to","{","'record","'",":","{","'region","'",":","'us-east-1","'",",","'detail","'",":","{","'awsRegion","'",":","'us-west-2'","}","}",",","'streamalert_normalization","'",":","{","'region","'",":","[","{","'values","'",":","[","'region_name","'","]",",","'function","'",":","'AWS","region'","}",",","{","'values","'",":","[","'region_name","'","]",",","'function","'",":","'AWS","region","'",",","'send_to_artifacts","'",":","False","}","]","}","}"]
code: def _extract_artifacts(source_type, records):
      """Extract all artifacts from a record
  
      Returns:
          list: A list of Artifacts from a normalized record.
  
      normalized information in the record will be similar to
      {
          'record': {
              'region': 'us-east-1',
              'detail': {
                  'awsRegion': 'us-west-2'
              }
          },
          'streamalert_normalization': {
              'region': [
                  {
                      'values': ['region_name'],
                      'function': 'AWS region'
                  },
                  {
                      'values': ['region_name'],
                      'function': 'AWS region',
                      'send_to_artifacts': False
                  }
              ]
          }
      }
      """
      artifacts = []
  
      for record in records:
          if not record.get(Normalizer.NORMALIZATION_KEY):
              continue
  
          record_id = record[Normalizer.NORMALIZATION_KEY].get(
              Normalizer.RECORD_ID_KEY
          ) or str(uuid.uuid4())
          for key, values in record[
              Normalizer.NORMALIZATION_KEY
          ].items():
              if key == Normalizer.RECORD_ID_KEY:
                  continue
  
              for value in values:
                  # Skip the normalized value is SNED_TO_ARTIFACTS_FLAG set to "false", which is
                  # default to "true".
                  if not value.get(CONST_ARTIFACTS_FLAG, True):
                      continue
  
                  for val in value.get("values", []):
                      artifacts.append(
                          Artifact(
                              function=value.get("function"),
                              record_id=record_id,
                              # source_type=self._source_type,
                              source_type=source_type,
                              normalized_type=key,
                              value=val,
                          )
                      )
  
      return artifacts
  
file_path: streamalert/streamalert/shared/artifact_extractor.py
imports: import re
  import uuid
  from streamalert.shared.firehose import FirehoseClient
  from streamalert.shared import CLASSIFIER_FUNCTION_NAME, config
  from streamalert.shared.metrics import MetricLogger
  from streamalert.shared.normalize import Normalizer, CONST_ARTIFACTS_FLAG
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 4 for calling the ArtifactExtractor obj's underlying member method code with example usage: obj._extract_artifacts(source_type, records) and returns: artifacts