def set_elem(elem_ref, elem):
if elem_ref is None or elem_ref == elem or not is_elem_ref(elem_ref):<EOL><INDENT>return elem<EOL><DEDENT>elif elem_ref[<NUM_LIT:0>] == ElemRefObj:<EOL><INDENT>setattr(elem_ref[<NUM_LIT:1>], elem_ref[<NUM_LIT:2>], elem)<EOL>return elem<EOL><DEDENT>elif elem_ref[<NUM_LIT:0>] == ElemRefArr:<EOL><INDENT>elem_ref[<NUM_LIT:1>][elem_ref[<NUM_LIT:2>]] = elem<EOL>return elem<EOL><DEDENT>
Sets element referenced by the elem_ref. Returns the elem.

:param elem_ref:
:param elem:
:return: