code: def __resolve_type(self, nobuiltin=False):
          
          # There is no need for a recursive implementation here since a node can
          # reference an external type node but XSD specification explicitly
          # states that that external node must not be a reference to yet another
          # node.
          qref = self.qref()
          if qref is None:
              return self
          query = TypeQuery(qref)
          query.history = [self]
          log.debug("%s, resolving: %s\n using:%s", self.id, qref, query)
          resolved = query.execute(self.schema)
          if resolved is None:
              log.debug(self.schema)
              raise TypeNotFound(qref)
          if resolved.builtin() and nobuiltin:
              return self
          return resolved
docs: Private resolve() worker without any result caching.
  
          @param nobuiltin: Flag indicating whether resolving to XSD built-in
              types should not be allowed.
          @return: The resolved (true) type.
          @rtype: L{SchemaObject}