The coalescent with arbitrary spatial and genetic structure