def find_ss_regions(dssp_residues):
    """Separates parsed DSSP data into groups of secondary structure.

    Notes
    -----
    Example: all residues in a single helix/loop/strand will be gathered
    into a list, then the next secondary structure element will be
    gathered into a separate list, and so on.

    Parameters
    ----------
    dssp_residues : [list]
        Each internal list contains:
            [0] int Residue number
            [1] str Secondary structure type
            [2] str Chain identifier
            [3] str Residue type
            [4] float Phi torsion angle
            [5] float Psi torsion angle

    Returns
    -------
    fragments : [[list]]
        Lists grouped in continuous regions of secondary structure.
        Innermost list has the same format as above.
    """

    loops = [' ', 'B', 'S', 'T']
    current_ele = None
    fragment = []
    fragments = []
    first = True
    for ele in dssp_residues:
        if first:
            first = False
            fragment.append(ele)
        elif current_ele in loops:
            if ele[1] in loops:
                fragment.append(ele)
            else:
                fragments.append(fragment)
                fragment = [ele]
        else:
            if ele[1] == current_ele:
                fragment.append(ele)
            else:
                fragments.append(fragment)
                fragment = [ele]
        current_ele = ele[1]
    return fragments
Separates parsed DSSP data into groups of secondary structure.

    Notes
    -----
    Example: all residues in a single helix/loop/strand will be gathered
    into a list, then the next secondary structure element will be
    gathered into a separate list, and so on.

    Parameters
    ----------
    dssp_residues : [list]
        Each internal list contains:
            [0] int Residue number
            [1] str Secondary structure type
            [2] str Chain identifier
            [3] str Residue type
            [4] float Phi torsion angle
            [5] float Psi torsion angle

    Returns
    -------
    fragments : [[list]]
        Lists grouped in continuous regions of secondary structure.
        Innermost list has the same format as above.