def get_transitions(sequence):
	"""
	Extracts a list of transitions from a sequence, returning a list of lists containing each transition.

	Example
	--------
	>>> sequence = [1,2,2,1,2,3,2,3,1]
	>>> ps.get_transitions(sequence)
	[[1, 2], [2, 1], [1, 2], [2, 3], [3, 2], [2, 3], [3, 1]]

	"""

	transitions = []
	for position in range(len(sequence) - 1):
		if sequence[position] != sequence[position + 1]:
			transitions.append([sequence[position], sequence[position + 1]])

	return transitions