original_docstring: 
      Receives list of offenses, and enriches the offenses with the following:
      - Changes offense_type value from the offense type ID to the offense type name.
      - Changes closing_reason_id value from closing reason ID to the closing reason name.
      - Adds a link to the URL of each offense.
      - Adds the domain name of the domain ID for each offense.
      - Adds to each rule of the offense its name.
      - Adds enrichment to each source/destination IP ID to its address (if enrich_ip_addresses is true).
      - Adds enrichment of assets to each offense (if enrich_assets is true).
      Args:
          client (Client): Client to perform the API calls.
          offenses (Any): List of all of the offenses to enrich.
          enrich_ip_addresses (bool): Whether to enrich the offense source/destination IP addresses.
          enrich_assets (bool): Whether to enrich the offense with assets.
  
      Returns:
          (List[Dict]): The enriched offenses.
      
docstring: Receives list of offenses, and enriches the offenses with the following:
  Changes offense_type value from the offense type ID to the offense type name.
  Changes closing_reason_id value from closing reason ID to the closing reason name.
  Adds a link to the URL of each offense.
  Adds the domain name of the domain ID for each offense.
  Adds to each rule of the offense its name.
  Adds enrichment to each source/destination IP ID to its address (if enrich_ip_addresses is true).
  Adds enrichment of assets to each offense (if enrich_assets is true).
docstring_tokens: Receives list of offenses and enriches the offenses with the following : Changes offense_type value from the offense type ID to the offense type name . Changes closing_reason_id value from closing reason ID to the closing reason name . Adds a link to the URL of each offense . Adds the domain name of the domain ID for each offense . Adds to each rule of the offense its name . Adds enrichment to each source / destination IP ID to its address ( if enrich_ip_addresses is true ) . Adds enrichment of assets to each offense ( if enrich_assets is true ) .
code: def enrich_offenses_result(client: Client, offenses: Any, enrich_ip_addresses: bool,
                             enrich_assets: bool) -> List[Dict]:
      """
      Receives list of offenses, and enriches the offenses with the following:
      - Changes offense_type value from the offense type ID to the offense type name.
      - Changes closing_reason_id value from closing reason ID to the closing reason name.
      - Adds a link to the URL of each offense.
      - Adds the domain name of the domain ID for each offense.
      - Adds to each rule of the offense its name.
      - Adds enrichment to each source/destination IP ID to its address (if enrich_ip_addresses is true).
      - Adds enrichment of assets to each offense (if enrich_assets is true).
      Args:
          client (Client): Client to perform the API calls.
          offenses (Any): List of all of the offenses to enrich.
          enrich_ip_addresses (bool): Whether to enrich the offense source/destination IP addresses.
          enrich_assets (bool): Whether to enrich the offense with assets.
  
      Returns:
          (List[Dict]): The enriched offenses.
      """
      if not isinstance(offenses, list):
          offenses = [offenses]
  
      print_debug_msg('Enriching offenses')
      offense_types_id_name_dict = get_offense_types(client, offenses)
      closing_reasons_id_name_dict = get_offense_closing_reasons(client, offenses)
      domain_id_name_dict = get_domain_names(client, offenses) if DOMAIN_ENRCH_FLG.lower() == 'true' else dict()
      rules_id_name_dict = get_rules_names(client, offenses) if RULES_ENRCH_FLG.lower() == 'true' else dict()
      source_addresses_id_ip_dict = get_offense_addresses(client, offenses, False) if enrich_ip_addresses else dict()
      destination_addresses_id_ip_dict = get_offense_addresses(client, offenses, True) if enrich_ip_addresses else dict()
  
      def create_enriched_offense(offense: Dict) -> Dict:
          link_to_offense_suffix = '/console/do/sem/offensesummary?appName=Sem&pageId=OffenseSummary&summaryId'\
                                   f'''={offense.get('id')}'''
          basic_enriches = {
              'offense_type': offense_types_id_name_dict.get(offense.get('offense_type')),
              'closing_reason_id': closing_reasons_id_name_dict.get(offense.get('closing_reason_id')),
              'LinkToOffense': urljoin(client.server, link_to_offense_suffix),
          }
  
          domain_enrich = {
              'domain_name': domain_id_name_dict.get(offense.get('domain_id'))
          } if DOMAIN_ENRCH_FLG.lower() == 'true' and domain_id_name_dict.get(offense.get('domain_id')) else dict()
  
          rules_enrich = {
              'rules': [{
                  'id': rule.get('id'),
                  'type': rule.get('type'),
                  'name': rules_id_name_dict.get(rule.get('id'))
              } for rule in offense.get('rules', [])] if RULES_ENRCH_FLG.lower() == 'true' else dict()
          }
  
          source_addresses_enrich = {
              'source_address_ids': [source_addresses_id_ip_dict.get(source_address_id) for source_address_id in
                                     offense.get('source_address_ids', [])]
          } if enrich_ip_addresses else dict()
  
          destination_addresses_enrich = {
              'local_destination_address_ids': [destination_addresses_id_ip_dict.get(destination_address_id) for
                                                destination_address_id in
                                                offense.get('local_destination_address_ids', [])]
          } if enrich_ip_addresses else dict()
  
          if enrich_assets:
              source_ips: List = source_addresses_enrich.get('source_address_ids', [])
              destination_ips: List = destination_addresses_enrich.get('local_destination_address_ids', [])
              all_ips: List = source_ips + destination_ips
              asset_enrich = {'assets': enrich_offense_with_assets(client, all_ips)}
          else:
              asset_enrich = dict()
  
          return dict(offense, **basic_enriches, **domain_enrich, **rules_enrich, **source_addresses_enrich,
                      **destination_addresses_enrich, **asset_enrich)
  
      result = [create_enriched_offense(offense) for offense in offenses]
      print_debug_msg('Enriched offenses successfully.')
      return result
code_tokens: def enrich_offenses_result ( client : Client , offenses : Any , enrich_ip_addresses : bool , enrich_assets : bool ) -> List [ Dict ] : if not isinstance ( offenses , list ) : offenses = [ offenses ] print_debug_msg ( 'Enriching offenses' ) offense_types_id_name_dict = get_offense_types ( client , offenses ) closing_reasons_id_name_dict = get_offense_closing_reasons ( client , offenses ) domain_id_name_dict = get_domain_names ( client , offenses ) if DOMAIN_ENRCH_FLG . lower ( ) == 'true' else dict ( ) rules_id_name_dict = get_rules_names ( client , offenses ) if RULES_ENRCH_FLG . lower ( ) == 'true' else dict ( ) source_addresses_id_ip_dict = get_offense_addresses ( client , offenses , False ) if enrich_ip_addresses else dict ( ) destination_addresses_id_ip_dict = get_offense_addresses ( client , offenses , True ) if enrich_ip_addresses else dict ( ) def create_enriched_offense ( offense : Dict ) -> Dict : link_to_offense_suffix = '/console/do/sem/offensesummary?appName=Sem&pageId=OffenseSummary&summaryId' f'''={offense.get('id')}''' basic_enriches = { 'offense_type' : offense_types_id_name_dict . get ( offense . get ( 'offense_type' ) ) , 'closing_reason_id' : closing_reasons_id_name_dict . get ( offense . get ( 'closing_reason_id' ) ) , 'LinkToOffense' : urljoin ( client . server , link_to_offense_suffix ) , } domain_enrich = { 'domain_name' : domain_id_name_dict . get ( offense . get ( 'domain_id' ) ) } if DOMAIN_ENRCH_FLG . lower ( ) == 'true' and domain_id_name_dict . get ( offense . get ( 'domain_id' ) ) else dict ( ) rules_enrich = { 'rules' : [ { 'id' : rule . get ( 'id' ) , 'type' : rule . get ( 'type' ) , 'name' : rules_id_name_dict . get ( rule . get ( 'id' ) ) } for rule in offense . get ( 'rules' , [ ] ) ] if RULES_ENRCH_FLG . lower ( ) == 'true' else dict ( ) } source_addresses_enrich = { 'source_address_ids' : [ source_addresses_id_ip_dict . get ( source_address_id ) for source_address_id in offense . get ( 'source_address_ids' , [ ] ) ] } if enrich_ip_addresses else dict ( ) destination_addresses_enrich = { 'local_destination_address_ids' : [ destination_addresses_id_ip_dict . get ( destination_address_id ) for destination_address_id in offense . get ( 'local_destination_address_ids' , [ ] ) ] } if enrich_ip_addresses else dict ( ) if enrich_assets : source_ips : List = source_addresses_enrich . get ( 'source_address_ids' , [ ] ) destination_ips : List = destination_addresses_enrich . get ( 'local_destination_address_ids' , [ ] ) all_ips : List = source_ips + destination_ips asset_enrich = { 'assets' : enrich_offense_with_assets ( client , all_ips ) } else : asset_enrich = dict ( ) return dict ( offense , ** basic_enriches , ** domain_enrich , ** rules_enrich , ** source_addresses_enrich , ** destination_addresses_enrich , ** asset_enrich ) result = [ create_enriched_offense ( offense ) for offense in offenses ] print_debug_msg ( 'Enriched offenses successfully.' ) return result
short_docstring: Receives list of offenses, and enriches the offenses with the following:
   Changes offense_type value from the offense type ID to the offense type name.
short_docstring_tokens: Receives list of offenses and enriches the offenses with the following : Changes offense_type value from the offense type ID to the offense type name .
comment: """
      Receives list of offenses, and enriches the offenses with the following:
      - Changes offense_type value from the offense type ID to the offense type name.
      - Changes closing_reason_id value from closing reason ID to the closing reason name.
      - Adds a link to the URL of each offense.
      - Adds the domain name of the domain ID for each offense.
      - Adds to each rule of the offense its name.
      - Adds enrichment to each source/destination IP ID to its address (if enrich_ip_addresses is true).
      - Adds enrichment of assets to each offense (if enrich_assets is true).
      Args:
          client (Client): Client to perform the API calls.
          offenses (Any): List of all of the offenses to enrich.
          enrich_ip_addresses (bool): Whether to enrich the offense source/destination IP addresses.
          enrich_assets (bool): Whether to enrich the offense with assets.
  
      Returns:
          (List[Dict]): The enriched offenses.
      """