I assume in the same way :SYSTem:SETup? returns the data, which seems to work just feeding it back to the scope verbatim.
That format is:
:SYSTem:SETup #9000002579<data>\n
Beware that you're actually writing the bytes as they came from the scope though, as many mechanisms for doing this might be doing conversion to other character sets etc.
In other words, this code works:
config = rigol.ask_raw(":SYSTem:SETup?")
rigol.write_raw(":SYST:SET " + config)