turn a django model into a po file.

def poify(self, model):
        """turn a django model into a po file."""
        if not hasattr(model, 'localized_fields'):
            return None

        # create po stream with header
        po_stream = polibext.PoStream(StringIO.StringIO(self.po_header)).parse()

        for (name, field) in easymode.tree.introspection.get_default_field_descriptors(model):
            occurrence = u"%s.%s.%s" % (model._meta.app_label, model.__class__.__name__, name)
            value = field.value_to_string(model)

            # only add empty strings
            if value != "":
                entry = polib.POEntry(msgid=value, occurrences=[(occurrence, model.pk)])
                # make sure no duplicate entries in the po_stream
                existing_entry = po_stream.find(entry.msgid)
                if existing_entry is None:
                    po_stream.append(entry)
                else:
                    # no really, existing_entry.merge does not merge the occurrences.
                    existing_entry.occurrences += entry.occurrences

        return po_stream