Post-synthetic halide conversion and selective halogen capture in hybrid perovskites