def _check_content(self, content):
        try:
            po = polib.pofile(content)
        except __HOLE__, e:
            logger.warning("Parse error: %s" % e, exc_info=True)
            raise PoParseError(unicode(e))

        # If file is empty, the method hangs so we should bail out.
        if not content:
            logger.warning("Pofile: File '%s' is empty." % self.filename)
            raise PoParseError("Uploaded file is empty.")

        # Msgfmt check
        if settings.FILECHECKS['POFILE_MSGFMT']:
            msgfmt_check(content, self.is_pot)

        # Check required header fields
        required_metadata = ['Content-Type', 'Content-Transfer-Encoding']
        for metadata in required_metadata:
            if not metadata in po.metadata:
                logger.warning(
                    "pofile: Required metadata '%s' not found." % metadata
                )
                raise PoParseError(_(
                    "Uploaded file header doesn't have '%s' metadata!" % metadata
                ))

        # Save to avoid parsing it again
        self._po = po
dataset/ETHPy150Open rvanlaar/easy-transifex/src/transifex/transifex/resources/formats/pofile.py/GettextHandler._check_content