code: def apply_visitor(visitor, decl_inst):
      
  
      fname = 'visit_' + \
          decl_inst.__class__.__name__[:-2]  # removing '_t' from class name
      if not hasattr(visitor, fname):
          raise runtime_errors.visit_function_has_not_been_found_t(
              visitor, decl_inst)
      return getattr(visitor, fname)()
docs: Applies a visitor on declaration instance.
  
      :param visitor: instance
      :type visitor: :class:`type_visitor_t` or :class:`decl_visitor_t`