code: def GetSchema(component):
      
      parent = component
      while not isinstance(parent, XMLSchema):
          parent = parent._parent()
      return parent
docs: convience function for finding the parent XMLSchema instance.