<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def random_save(rnd: Optional[tcod.random.Random]) -> tcod.random.Random: """Return a copy of a random number generator. .. deprecated:: 8.4 You can use the standard library copy and pickle modules to save a random state. """

    return tcod.random.Random._new_from_cdata(
        ffi.gc(
            ffi.cast(
                "mersenne_data_t*",
                lib.TCOD_random_save(rnd.random_c if rnd else ffi.NULL),
            ),
            lib.TCOD_random_delete,
        )
    )