def filter_state(hdf_file_content, link_id, state='State0'):
    """Get the time series of a state for a link
    
    Parameters
    ----------
    hdf_file_content : np.array
        data in the h5 file as a numpy array

    link_id : int
        link_id to be filtered
    
    state : str , ex. State0(default), State1 ... 
        state to be retrieved from h5 file

    Returns
    ------
    time : np.array
        array of timesteps
    
    state: np.array
        state time series
    
    """

    index = hdf_file_content['LinkID'] == link_id
    time = hdf_file_content['Time'][index]
    state = hdf_file_content[state][index]

    return time, state