<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _insert_operations(self, operations: Sequence[ops.Operation], insertion_indices: Sequence[int]) -> None: """Inserts operations at the specified moments. Appends new moments if necessary. Args: operations: The operations to insert. insertion_indices: Where to insert them, i.e. operations[i] is inserted into moments[insertion_indices[i]. Raises: ValueError: operations and insert_indices have different lengths. NB: It's on the caller to ensure that the operations won't conflict with operations already in the moment or even each other. """

        if len(operations) != len(insertion_indices):
            raise ValueError('operations and insertion_indices must have the'
                             'same length.')
        self._moments += [
            ops.Moment() for _ in range(1 + max(insertion_indices) - len(self))
        ]
        moment_to_ops = defaultdict(list
                                    )  # type: Dict[int, List[ops.Operation]]
        for op_index, moment_index in enumerate(insertion_indices):
            moment_to_ops[moment_index].append(operations[op_index])
        for moment_index, new_ops in moment_to_ops.items():
            self._moments[moment_index] = ops.Moment(
                self._moments[moment_index].operations + tuple(new_ops))