code: def cast_out(self, klass):
          
          if _debug: Any._debug("cast_out %r", klass)
          global _sequence_of_classes, _list_of_classes
  
          # check for a sequence element
          if (klass in _sequence_of_classes) or (klass in _list_of_classes):
              # build a sequence helper
              helper = klass()
  
              # make a copy of the tag list
              t = TagList(self.tagList[:])
  
              # let it decode itself
              helper.decode(t)
  
              # make sure everything was consumed
              if len(t) != 0:
                  raise DecodingError("incomplete cast")
  
              # return what was built
              return helper.value
  
          # check for an array element
          elif klass in _array_of_classes:
              # build a sequence helper
              helper = klass()
  
              # make a copy of the tag list
              t = TagList(self.tagList[:])
  
              # let it decode itself
              helper.decode(t)
  
              # make sure everything was consumed
              if len(t) != 0:
                  raise DecodingError("incomplete cast")
  
              # return what was built with Python list semantics
              return helper.value[1:]
  
          elif issubclass(klass, (Atomic, AnyAtomic)):
              # make sure there's only one piece
              if len(self.tagList) == 0:
                  raise DecodingError("missing cast component")
              if len(self.tagList) > 1:
                  raise DecodingError("too many cast components")
  
              if _debug: Any._debug("    - building helper: %r", klass)
  
              # a helper cooperates between the atomic value and the tag
              helper = klass(self.tagList[0])
  
              # return the value
              return helper.value
  
          else:
              if _debug: Any._debug("    - building value: %r", klass)
  
              # build an element
              value = klass()
  
              # make a copy of the tag list
              t = TagList(self.tagList[:])
  
              # let it decode itself
              value.decode(t)
  
              # make sure everything was consumed
              if len(t) != 0:
                  raise DecodingError("incomplete cast")
  
              # return what was built
              return value
docs: Interpret the content as a particular class.