Plebański–Demiański solution of general relativity and its expressions quadratic and cubic in curvature: Analogies to electromagnetism