def is_valid(self):
        # Using BytesIO as configparser in 2.7 can't work with unicode
        # see http://bugs.python.org/issue11597
        with BytesIO(self.content) as buf:
            self.config = configparser.ConfigParser()
            try:
                # Try python3 method
                try:
                    self.config.read_string(self.content.decode('unicode_escape'))
                except __HOLE__:
                    # Fallback to py2 method
                    self.config.readfp(buf)
            except configparser.Error:
                self.log.warn("Invalid repo file found: '%s'", self.content)
                return False
            else:
                return True
dataset/ETHPy150Open projectatomic/atomic-reactor/atomic_reactor/plugins/pre_add_yum_repo_by_url.py/YumRepo.is_valid