Finite-sample risk bounds for maximum likelihood estimation with arbitrary penalties