def _validate_file_format(self, file_format):
        """Validates file format, raising error if invalid."""

        if file_format not in self.valid_file_formats:
            raise InvalidFileFormatError(
                "{} is not a valid file format".format(file_format)
            )

        return file_format
Validates file format, raising error if invalid.