Check the signal at its source
Code P2271 describes a condition in the oxygen (O2) sensor for bank one, sensor two: the signal has stopped changing and reports a rich condition even as engine conditions change. That names where to look, but it does not by itself confirm which part has failed.
How to tell the paths apart: Read the live data and compare it against the expected range for current conditions before replacing anything.