  We present a unified framework to efficiently approximate solutions to
fractional diffusion problems of stationary and parabolic type. After
discretization, we can take the point of view that the solution is obtained by
a matrix-vector product of the form $f^{\boldsymbol{\tau}}(L)\mathbf{b}$, where
$L$ is the discretization matrix of the spatial operator, $\mathbf{b}$ a
prescribed vector, and $f^{\boldsymbol{\tau}}$ a parametric function, such as
the fractional power or the Mittag-Leffler function. In the abstract framework
of Stieltjes and complete Bernstein functions, to which the functions we are
interested in belong to, we apply a rational Krylov method and prove uniform
convergence when using poles based on Zolotar\"ev's minimal deviation problem.
The latter are particularly suited for fractional diffusion as they allow for
an efficient query of the map $\boldsymbol{\tau}\mapsto
f^{\boldsymbol{\tau}}(L)\mathbf{b}$ and do not degenerate as the fractional
parameters approach zero.
  We also present a variety of both novel and existing pole selection
strategies for which we develop a computable error certificate. Our numerical
experiments comprise a detailed parameter study of space-time fractional
diffusion problems and compare the performance of the poles with the ones
predicted by our certificate.
