code: def rnn(
      step_function,
      inputs,
      initial_states,
      go_backwards=False,
      mask=None,
      constants=None,
      unroll=False,
      input_length=None,
      time_major=False,
      zero_output_for_mask=False,
      return_all_outputs=True,
  ):
      @functools.wraps(step_function)
      def _new_step_function(*args, **kwargs):
          frontend_args = ivy.nested_map(
              _ivy_array_to_tensorflow,
              args,
              include_derived=True,
              shallow=False,
          )
          frontend_kwargs = ivy.nested_map(
              _ivy_array_to_tensorflow,
              kwargs,
              include_derived=True,
              shallow=False,
          )
          ret = step_function(*frontend_args, **frontend_kwargs)
          return ivy.nested_map(
              _to_ivy_array, ret, include_derived=True
          )
  
      return ivy.rnn(
          _new_step_function,
          inputs,
          initial_states,
          go_backwards=go_backwards,
          mask=mask,
          constants=constants,
          unroll=unroll,
          input_length=input_length,
          time_major=time_major,
          zero_output_for_mask=zero_output_for_mask,
          return_all_outputs=return_all_outputs,
      )
  
imports: import functools
  import ivy
  import ivy.functional.frontends.tensorflow
  from ivy.functional.frontends.tensorflow.func_wrapper import _ivy_array_to_tensorflow, _to_ivy_array, to_ivy_arrays_and_back
label_desc: Use image node_id 3 for calling a global function with example usage: rnn(step_function, inputs, initial_states, go_backwards, mask, constants, unroll, input_length, time_major, zero_output_for_mask, return_all_outputs) and returns: ivy, ivy