Black Holes with Topological Defects: The C-metric in Three and Four Dimensions