def check_for_border(m_index_list, m_borders):
    """ Checks for the borders of membrane regions, from M indices.

    Parameters
    ----------
    m_indices : list
        List of membrane region indices, extracted from the flatfile, (e.g. IIIMMMMMMMMMOOOO for Inside, Membrane and Outside),
        giving the list of M indices (e.g. [28, 29, 30, 31, 32, 33, 34, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 72, 73, 74, 75, 76]
    m_borders : list
        List of borders, where the membrane regions start and stop.

    Returns
    -------
    m_borders : list
        Updated list of borders
    """
    # iterate through the m_index_list (e.g. [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33] for a singlepass protein)
    for n in range(0, len(m_index_list) - 1):
        # if the two indices next to each other are not consecutive numbers
        if m_index_list[n] + 1 != m_index_list[n + 1]:
            # add the first one to the list
            m_borders.append(m_index_list[n])
            # add the second one to the list
            m_borders.append(m_index_list[n + 1])
    return m_borders