Set the logger if is not None, and it is of type Logger.

def logger(self, logger):
        """Set the logger if is not None, and it is of type Logger."""
        if logger is None or not isinstance(logger, Logger):
            raise ValueError("Logger can not be set to None, and must be of type logging.Logger")

        self._logger = logger