<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def reward(self,
               state: Sequence[tf.Tensor],
               action: Sequence[tf.Tensor],
               next_state: Sequence[tf.Tensor]) -> tf.Tensor:
        '''Compiles the reward function given the current `state`, `action` and
        `next_state`.

        Args:
            state (Sequence[tf.Tensor]): A tuple of current state tensors.
            action (Sequence[tf.Tensor]): A tuple of action tensors.
            next_state (Sequence[tf.Tensor]): A tuple of next state tensors.

        Returns:
            (:obj:`tf.Tensor`): A tensor representing the reward function.
        '''
        scope = self.reward_scope(state, action, next_state)
        r = self.compile_reward(scope).tensor
        with self.graph.as_default():
            with tf.name_scope('reward'):
                return tf.expand_dims(r, -1)