def phi_selection(residue):
    """AtomGroup corresponding to the phi protein backbone dihedral
        C'-N-CA-C.

        Returns
        -------
        AtomGroup
            4-atom selection in the correct order. If no C' found in the
            previous residue (by resid) then this method returns ``None``.
        """
    sel_str = 'segid {} and resid {} and name C'.format(residue.segment.
        segid, residue.resid - 1)
    sel = residue.universe.select_atoms(sel_str) + residue.atoms.select_atoms(
        'name N', 'name CA', 'name C')
    if len(sel) == 4:
        return sel
    else:
        return None
