def _write_entries(self, stream, entries, converter, properties=None):
        """Write iterable of entries as YAML object to stream.

        Args:
            stream: File-like object.
            entries: Iterable of entries.
            converter: Conversion function from entry to YAML object.
            properties: Set of compartment properties to output (or None to
                output all).
        """
        def iter_entries():
            for c in entries:
                entry = converter(c)
                if entry is None:
                    continue
                if properties is not None:
                    entry = OrderedDict(
                        (key, value) for key, value in iteritems(entry)
                        if key == 'id' or key in properties)
                yield entry

        self._dump(stream, list(iter_entries()))