code: def _classify(_rawtypedef, _rawterms):
          
          terms = collections.OrderedDict()
          _cached_synonyms = {}
  
          typedefs = [
              Relationship._from_obo_dict( # instantiate a new Relationship
                  {k:v for k,lv in six.iteritems(_typedef) for v in lv}
              )
              for _typedef in _rawtypedef
          ]
  
          for _term in _rawterms:
              synonyms = set()
  
              _id   = _term['id'][0]
              _name = _term.pop('name', ('',))[0]
              _desc = _term.pop('def', ('',))[0]
  
              _relations = collections.defaultdict(list)
              try:
                  for other in _term.get('is_a', ()):
                      _relations[Relationship('is_a')].append(other.split('!')[0].strip())
              except IndexError:
                  pass
              try:
                  for relname, other in ( x.split(' ', 1) for x in _term.pop('relationship', ())):
                      _relations[Relationship(relname)].append(other.split('!')[0].strip())
              except IndexError:
                  pass
  
              for key, scope in six.iteritems(_obo_synonyms_map):
                  for obo_header in _term.pop(key, ()):
                      try:
                          s = _cached_synonyms[obo_header]
                      except KeyError:
                           s = Synonym.from_obo(obo_header, scope)
                           _cached_synonyms[obo_header] = s
                      finally:
                          synonyms.add(s)
  
              desc = Description.from_obo(_desc) if _desc else Description("")
  
              terms[_id] = Term(_id, _name, desc, dict(_relations), synonyms, dict(_term))
          return terms, typedefs
docs: Create proper objects out of extracted dictionnaries.
  
          New Relationship objects are instantiated with the help of
          the `Relationship._from_obo_dict` alternate constructor.
  
          New `Term` objects are instantiated by manually extracting id,
          name, desc and relationships out of the ``_rawterm``
          dictionnary, and then calling the default constructor.