def select_by_states(pathways, states):
    """Returns one pathway which goes through a given pattern of states 
    
    Returns unique pathway which goes through a given pattern of states
    or does not return anything

    The following diagram 

            |12       12|  
        --->|-----------|  
            |           |  
            |48       12|      2.0
        --->|-----------|  
            |           |  
            |21       12|      0.0
          >>|***********|<< 
            |           | 
            |6         6|      0.0
        --->|-----------|  
            |           |  
            |0         6|      -2.0
            |-----------|<---  
            |           |  
            |0         0|  
    
    turns into the following tuple
    
    ((0,0), (0,6), (6,6), (21, 12), (48, 12), (12,12))
    
    
    Parameters
    ----------
    
    pathways : list, tuple
        List of tuple of states to analyze
        
    states : list, tuple
        List of dyads which describe the states involved in a given Liouville
        pathway. States are listed from left to right, from bottom to the top
        
    
    
    """
    for pw in pathways:
        ch = -1
        for k in range(pw.states.shape[0]):
            if not (pw.states[k, 0] == states[k + 1][0]) & (pw.states[k, 1] ==
                states[k + 1][1]):
                break
            ch += 1
        if ch == k:
            return pw
