def get_last_chunk(buffer, info):
    """A sampler function to extract only the last chunk of the memory.
    """
    i_trans = info["num_records"]

    # Get the last chunk, reshaped (mix the first two dimensions)
    chunk = {}
    for key in buffer:
        chunk[key] = buffer[key][:,i_trans-info["num_steps"]-1:i_trans]
    return chunk