def deserialize_workflow_spec(self, s_state, filename=None):
if isinstance(s_state, (str, bytes)):<EOL><INDENT>s_state = BytesIO(s_state)<EOL><DEDENT>package_zip = zipfile.ZipFile(<EOL>s_state, "<STR_LIT:r>", compression=zipfile.ZIP_DEFLATED)<EOL>config = configparser.ConfigParser()<EOL>ini_fp = TextIOWrapper(<EOL>package_zip.open(Packager.METADATA_FILE), encoding="<STR_LIT>")<EOL>try:<EOL><INDENT>config.read_file(ini_fp)<EOL><DEDENT>finally:<EOL><INDENT>ini_fp.close()<EOL><DEDENT>parser_class = BpmnParser<EOL>try:<EOL><INDENT>parser_class_module = config.get(<EOL>'<STR_LIT>', '<STR_LIT>', fallback=None)<EOL><DEDENT>except TypeError:<EOL><INDENT>parser_class_module = config.get(<EOL>'<STR_LIT>', '<STR_LIT>', None)<EOL><DEDENT>if parser_class_module:<EOL><INDENT>mod = __import__(parser_class_module, fromlist=[<EOL>config.get('<STR_LIT>', '<STR_LIT>')])<EOL>parser_class = getattr(mod, config.get('<STR_LIT>', '<STR_LIT>'))<EOL><DEDENT>parser = parser_class()<EOL>for info in package_zip.infolist():<EOL><INDENT>parts = os.path.split(info.filename)<EOL>if (len(parts) == <NUM_LIT:2> and<EOL>not parts[<NUM_LIT:0>] and parts[<NUM_LIT:1>].lower().endswith('<STR_LIT>')):<EOL><INDENT>try:<EOL><INDENT>svg = package_zip.read(info.filename[:-<NUM_LIT:5>] + '<STR_LIT>')<EOL><DEDENT>except KeyError:<EOL><INDENT>svg = None<EOL><DEDENT>bpmn_fp = package_zip.open(info)<EOL>try:<EOL><INDENT>bpmn = ET.parse(bpmn_fp)<EOL><DEDENT>finally:<EOL><INDENT>bpmn_fp.close()<EOL><DEDENT>parser.add_bpmn_xml(<EOL>bpmn, svg=svg,<EOL>filename='<STR_LIT>' % (filename, info.filename))<EOL><DEDENT><DEDENT>return parser.get_spec(config.get('<STR_LIT>', '<STR_LIT>'))<EOL>
:param s_state: a byte-string with the contents of the packaged
workflow archive, or a file-like object.

:param filename: the name of the package file.