def get_last_data_index(
        self, company_names, checkpoint_obj: CheckpointManager, company_state, table_name
    ):
        """Get the index for fetching last data.

        Args:
            company_names (list): List of company names.
            checkpoint_obj (CheckpointManager): CheckpointManager object.
            company_state (str): State of the company.
            table_name (str): Table name from which data should be fetched in case of checkpoint file corrupted.

        Returns:
            int: Index for fetching last data.
        """
        last_company_name = checkpoint_obj.get_last_data(
            company_state, company_name_flag=True, table_name=table_name, checkpoint_query=COMPANY_FETCH_QUERY
        )
        fetching_index = -1
        if last_company_name is not None:
            if last_company_name != company_names[-1]:
                fetching_index = company_names.index(last_company_name)
                applogger.debug(
                    "{} Started data fetching from index {}.".format(
                        self.logs_starts_with, fetching_index + 1
                    )
                )
            else:
                applogger.debug(
                    "{} Fetching should start from first index.".format(
                        self.logs_starts_with
                    )
                )
        return fetching_index
Get the index for fetching last data.

        Args:
            company_names (list): List of company names.
            checkpoint_obj (CheckpointManager): CheckpointManager object.
            company_state (str): State of the company.
            table_name (str): Table name from which data should be fetched in case of checkpoint file corrupted.

        Returns:
            int: Index for fetching last data.
        
Solutions/BitSight/Data Connectors/BitSightDataConnector/SharedCode/bitsight_client.py