def _get_enz_states(er_mech: str) -> list:
    """
    Given a string with the enzyme mechanism written as a sequence of elementary reactions produces a list with the
    enzyme state numbers and metabolites that bind/unbind to the respective enzyme states.

    Args:
        er_mech: string with elementary reactions that describe the enzyme mechanism.

    Returns:
       List with all enzyme state numbers and substrates.
    """

    er_mech = er_mech.replace('<->', '')
    er_mech = er_mech.replace('+', '')
    er_mech_list = er_mech.split()

    enz_states_dic = {}
    enz_states_list = []
    state_i = 1

    for i, entry in enumerate(er_mech_list):
        if entry.startswith('E_'):
            if entry not in enz_states_dic.keys():
                enz_states_dic[entry] = state_i
                enz_states_list.append([state_i])
                state_i += 1
            else:
                enz_states_list.append([enz_states_dic[entry]])

            if not er_mech_list[i + 1].startswith('E_'):
                enz_states_list[-1].append(er_mech_list[i + 1])

    return enz_states_list