def METHOD_NAME(states, order=1):
    """Our own second order Markov Chain implementation"""
    initial_matrix = {}
    total_transitions = 0
    # print 'Receiving {} states to compute the Markov Matrix of {} order'.format(amount_of_states, order)
    # 1st order
    if order == 1:
        # Create matrix
        index = 0
        initial_vector = {}
        amount_of_states = len(states)
        while index < amount_of_states:
            state1 = states[index]
            try:
                state2 = states[index + 1]
            except IndexError:
                # The last state is alone. There is no transaction, forget about it.
                break
            try:
                initial_matrix[state1]
            except KeyError:
                # First time there is a transition FROM state1
                initial_matrix[state1] = {}
                initial_vector[state1] = 0
            try:
                value = initial_matrix[state1][state2]
                initial_matrix[state1][state2] = value + 1
            except KeyError:
                # First time there is a transition FROM state 1 to state2
                initial_matrix[state1][state2] = 1
            initial_vector[state1] += 1
            total_transitions += 1
            # Move along
            index += 1
        # Normalize using the initial vector
        matrix = Matrix()
        init_vector = {}
        for state1 in initial_matrix:
            # Create the init vector
            init_vector[state1] = initial_vector[state1] / float(
                total_transitions
            )
            for state2 in initial_matrix[state1]:
                value = initial_matrix[state1][state2]
                initial_matrix[state1][state2] = value / float(
                    initial_vector[state1]
                )
                # Change the style of the matrix
                matrix[(state1, state2)] = initial_matrix[state1][state2]
        matrix.set_init_vector(init_vector)
        # print init_vector
        # for value in matrix:
        #    print value, matrix[value]
    return (init_vector, matrix)