import copy


def decode_data(data):
    """
    Decode data shared by the simulation main process.

    In multi-processing, the simulator will get data by shared memory, which
    are encoded by pickle to make them sharable.
    To avoid polluting the shared memory, we need to create a local copy.
    Since 'price' may also be in 'others', we should deepcopy the data
    separately instead of using copy.deepcopy(data).
    """
    return {
        'workdays' : copy.deepcopy(data['workdays']),
        'price' : copy.deepcopy(data['price']),
        'others' : copy.deepcopy(data['others'])}