def get_elem(elem_ref, default=None):
if not is_elem_ref(elem_ref):<EOL><INDENT>return elem_ref<EOL><DEDENT>elif elem_ref[<NUM_LIT:0>] == ElemRefObj:<EOL><INDENT>return getattr(elem_ref[<NUM_LIT:1>], elem_ref[<NUM_LIT:2>], default)<EOL><DEDENT>elif elem_ref[<NUM_LIT:0>] == ElemRefArr:<EOL><INDENT>return elem_ref[<NUM_LIT:1>][elem_ref[<NUM_LIT:2>]]<EOL><DEDENT>
Gets the element referenced by elem_ref or returns the elem_ref directly if its not a reference.

:param elem_ref:
:param default:
:return: