Cardiopulmonary bypass is a medical technique that temporarily takes over the function of the heart and lungs during surgery, maintaining the circulation of blood and the oxygen content of the body. It is primarily used in heart surgeries to provide a bloodless surgical field and to allow surgeons to operate on a still heart.