def compare_data_with_checkpoint(self, data_to_compare, state_manager_obj):
        """Compare data with checkpoint hash and return unique records.

        Args:
            data_to_compare (list): list of data to compare
            state_manager_obj (Statemanager): statemanager object to get checkpoint hash data

        Returns:
            list: list of unique data.
        """
        __method_name = inspect.currentframe().f_code.co_name
        try:
            hashed_data = self.convert_to_hash(data_to_compare)
            checkpoint_hash_list = self.get_checkpoint_data(state_manager_obj, True)
            if checkpoint_hash_list:
                applogger.info(
                    self.log_format.format(
                        consts.LOGS_STARTS_WITH,
                        __method_name,
                        self.azure_function_name,
                        "Found hashed data checkpoint.",
                    )
                )
                hash_record = {
                    hashed_data[i]: record for i, record in enumerate(data_to_compare)
                }
                unique_hashes = set(hashed_data) - set(checkpoint_hash_list)
                unique_data = [hash_record[hash] for hash in unique_hashes]
                return unique_data
            applogger.info(
                self.log_format.format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    self.azure_function_name,
                    "Hashed data checkpoint not found.",
                )
            )
            return data_to_compare
        except MimecastException:
            raise MimecastException()
        except Exception as err:
            applogger.error(
                self.log_format.format(
                    consts.LOGS_STARTS_WITH,
                    __method_name,
                    self.azure_function_name,
                    consts.UNEXPECTED_ERROR_MSG.format(err),
                )
            )
            raise MimecastException()
Compare data with checkpoint hash and return unique records.

        Args:
            data_to_compare (list): list of data to compare
            state_manager_obj (Statemanager): statemanager object to get checkpoint hash data

        Returns:
            list: list of unique data.
        
Solutions/Mimecast/Data Connectors/MimecastAT/SharedCode/utils.py