code: def parse(s):
      d = dict(ninputs=None, noutputs=None,
               input_labels=None, output_labels=None,
               intype=None, cover=set())
      lines = [line.strip() for line in s.splitlines()]
      for i, line in enumerate(lines, start=1):
          if not line or _COMMENT.match(line):
              continue
          m_in = _NINS.match(line)
          if m_in:
              if d['ninputs'] is None:
                  d['ninputs'] = int(m_in.group(1))
                  continue
              else:
                  raise Error(".i declared more than once")
          m_out = _NOUTS.match(line)
          if m_out:
              if d['noutputs'] is None:
                  d['noutputs'] = int(m_out.group(1))
                  continue
              else:
                  raise Error(".o declared more than once")
          m_prod = _PROD.match(line)
          if m_prod:
              continue
          m_ilb = _ILB.match(line)
          if m_ilb:
              if d['input_labels'] is None:
                  d['input_labels'] = m_ilb.group(1).split()
                  continue
              else:
                  raise Error(".ilb declared more than once")
          m_ob = _OB.match(line)
          if m_ob:
              if d['output_labels'] is None:
                  d['output_labels'] = m_ob.group(1).split()
                  continue
              else:
                  raise Error(".ob declared more than once")
          m_type = _TYPE.match(line)
          if m_type:
              if d['intype'] is None:
                  d['intype'] = _TYPES[m_type.group(1)]
                  continue
              else:
                  raise Error(".type declared more tha once")
          m_cube = _CUBE.match(line)
          if m_cube:
              inputs, outputs = m_cube.groups()
              invec = tuple(_INCODE[c] for c in inputs)
              outvec = tuple(_OUTCODE[c] for c in outputs)
              d['cover'].add((invec, outvec))
              continue
          m_end = _END.match(line)
          if m_end:
              continue
          raise Error("syntax error on line {}: {}".format(i, line))
      return d