Returns a batch instance given the filename.

def get_batch(self, filename=None):
        """Returns a batch instance given the filename.
        """
        try:
            history = self.history_model.objects.get(filename=filename)
        except self.history_model.DoesNotExist as e:
            raise TransactionsFileQueueError(
                f"Batch history not found for '{filename}'."
            ) from e
        if history.consumed:
            raise TransactionsFileQueueError(
                f"Batch closed for '{filename}'. Got consumed=True"
            )
        batch = self.batch_cls()
        batch.batch_id = history.batch_id
        batch.filename = history.filename
        return batch