  We develop a perturbation theory of quantum (and classical) master equations
with slowly varying parameters, applicable to systems which are externally
controlled on a time scale much longer than their characteristic relaxation
time. We apply this technique to the analysis of finite-time isothermal
processes in which, differently from quasi-static transformations, the state of
the system is not able to continuously relax to the equilibrium ensemble. Our
approach allows to formally evaluate perturbations up to arbitrary order to the
work and heat exchange associated to an arbitrary process. Within first order
in the perturbation expansion, we identify a general formula for the efficiency
at maximum power of a finite-time Carnot engine. We also clarify under which
assumptions and in which limit one can recover previous phenomenological
results as, for example, the Curzon-Ahlborn efficiency.
