<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _print_beam(self, sequences: mx.nd.NDArray, accumulated_scores: mx.nd.NDArray, finished: mx.nd.NDArray, inactive: mx.nd.NDArray, constraints: List[Optional[constrained.ConstrainedHypothesis]], timestep: int) -> None: """ Prints the beam for debugging purposes. :param sequences: The beam histories (shape: batch_size * beam_size, max_output_len). :param accumulated_scores: The accumulated scores for each item in the beam. Shape: (batch_size * beam_size, target_vocab_size). :param finished: Indicates which items are finished (shape: batch_size * beam_size). :param inactive: Indicates any inactive items (shape: batch_size * beam_size). :param timestep: The current timestep. """

        logger.info('BEAM AT TIMESTEP %d', timestep)
        batch_beam_size = sequences.shape[0]
        for i in range(batch_beam_size):
            # for each hypothesis, print its entire history
            score = accumulated_scores[i].asscalar()
            word_ids = [int(x.asscalar()) for x in sequences[i]]
            unmet = constraints[i].num_needed() if constraints[i] is not None else -1
            hypothesis = '----------' if inactive[i] else ' '.join(
                [self.vocab_target_inv[x] for x in word_ids if x != 0])
            logger.info('%d %d %d %d %.2f %s', i + 1, finished[i].asscalar(), inactive[i].asscalar(), unmet, score,
                        hypothesis)