def apply_visitor(visitor, decl_inst):
fname = '<STR_LIT>' +decl_inst.__class__.__name__[:-<NUM_LIT:2>]  <EOL>if not hasattr(visitor, fname):<EOL><INDENT>raise runtime_errors.visit_function_has_not_been_found_t(<EOL>visitor, decl_inst)<EOL><DEDENT>return getattr(visitor, fname)()<EOL>
Applies a visitor on declaration instance.

:param visitor: instance
:type visitor: :class:`type_visitor_t` or :class:`decl_visitor_t`