code: def cast(self, other_class):
          
  
          if other_class.tag != self.__class__.tag:
              raise TypeError(unwrap(
                  '''
                  Can not covert a value from %s object to %s object since they
                  use different tags: %d versus %d
                  ''',
                  type_name(other_class),
                  type_name(self),
                  other_class.tag,
                  self.__class__.tag
              ))
  
          new_obj = other_class()
          new_obj.class_ = self.class_
          new_obj.implicit = self.implicit
          new_obj.explicit = self.explicit
          new_obj._header = self._header
          new_obj.contents = self.contents
          new_obj._trailer = self._trailer
          if isinstance(self, Constructable):
              new_obj.method = self.method
              new_obj._indefinite = self._indefinite
          return new_obj
docs: Converts the current object into an object of a different class. The
          new class must use the ASN.1 encoding for the value.
  
          :param other_class:
              The class to instantiate the new object from
  
          :return:
              An instance of the type other_class