original_docstring: 
      Enriches offense given with events.
      Has retry mechanism for events returned by query to QRadar. This is needed because events might not be
      indexed when performing the search, and QRadar will return less events than expected.
      Retry mechanism here meant to avoid such cases as much as possible
      Args:
          client (Client): Client to perform the API calls.
          offense (Dict): Offense to enrich with events.
          fetch_mode (str): Which enrichment mode was requested.
                            Can be 'Fetch With All Events', 'Fetch Correlation Events Only'
          events_columns (str): Columns of the events to be extracted from query.
          events_limit (int): Maximum number of events to enrich the offense.
          max_retries (int): Number of retries.
  
      Returns:
          (Dict): Enriched offense with events.
      
docstring: Enriches offense given with events.
  Has retry mechanism for events returned by query to QRadar. This is needed because events might not be
  indexed when performing the search, and QRadar will return less events than expected.
  Retry mechanism here meant to avoid such cases as much as possible
docstring_tokens: Enriches offense given with events . Has retry mechanism for events returned by query to QRadar . This is needed because events might not be indexed when performing the search and QRadar will return less events than expected . Retry mechanism here meant to avoid such cases as much as possible
code: def enrich_offense_with_events(client: Client, offense: Dict, fetch_mode: str, events_columns: str, events_limit: int,
                                 max_retries: int = MAX_FETCH_EVENT_RETIRES):
      """
      Enriches offense given with events.
      Has retry mechanism for events returned by query to QRadar. This is needed because events might not be
      indexed when performing the search, and QRadar will return less events than expected.
      Retry mechanism here meant to avoid such cases as much as possible
      Args:
          client (Client): Client to perform the API calls.
          offense (Dict): Offense to enrich with events.
          fetch_mode (str): Which enrichment mode was requested.
                            Can be 'Fetch With All Events', 'Fetch Correlation Events Only'
          events_columns (str): Columns of the events to be extracted from query.
          events_limit (int): Maximum number of events to enrich the offense.
          max_retries (int): Number of retries.
  
      Returns:
          (Dict): Enriched offense with events.
      """
      if is_reset_triggered():
          return offense
  
      # decreasing 1 minute from the start_time to avoid the case where the minute queried of start_time equals end_time.
      for i in range(max_retries):
          # retry to check if we got all the event (its not an error retry), see docstring
          search_response = create_search_with_retry(client, fetch_mode, offense, events_columns,
                                                     events_limit)
          if not search_response:
              continue
  
          events = poll_offense_events_with_retry(client, search_response['search_id'], offense['id'])
          if len(events) >= min(offense.get('event_count', 0), events_limit):
              offense = dict(offense, events=events)
              break
          if i < max_retries - 1:
              time.sleep(SLEEP_FETCH_EVENT_RETIRES)
  
      return offense
code_tokens: def enrich_offense_with_events ( client : Client , offense : Dict , fetch_mode : str , events_columns : str , events_limit : int , max_retries : int = MAX_FETCH_EVENT_RETIRES ) : if is_reset_triggered ( ) : return offense for i in range ( max_retries ) : search_response = create_search_with_retry ( client , fetch_mode , offense , events_columns , events_limit ) if not search_response : continue events = poll_offense_events_with_retry ( client , search_response [ 'search_id' ] , offense [ 'id' ] ) if len ( events ) >= min ( offense . get ( 'event_count' , 0 ) , events_limit ) : offense = dict ( offense , events = events ) break if i < max_retries - 1 : time . sleep ( SLEEP_FETCH_EVENT_RETIRES ) return offense
short_docstring: Enriches offense given with events.
short_docstring_tokens: Enriches offense given with events .
comment: """
      Enriches offense given with events.
      Has retry mechanism for events returned by query to QRadar. This is needed because events might not be
      indexed when performing the search, and QRadar will return less events than expected.
      Retry mechanism here meant to avoid such cases as much as possible
      Args:
          client (Client): Client to perform the API calls.
          offense (Dict): Offense to enrich with events.
          fetch_mode (str): Which enrichment mode was requested.
                            Can be 'Fetch With All Events', 'Fetch Correlation Events Only'
          events_columns (str): Columns of the events to be extracted from query.
          events_limit (int): Maximum number of events to enrich the offense.
          max_retries (int): Number of retries.
  
      Returns:
          (Dict): Enriched offense with events.
      """$SEP$# decreasing 1 minute from the start_time to avoid the case where the minute queried of start_time equals end_time.$SEP$# retry to check if we got all the event (its not an error retry), see docstring