<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _snapshot_to_data(snapshot):
    '''
    Returns snapshot data from a D-Bus response.

    A snapshot D-Bus response is a dbus.Struct containing the
    information related to a snapshot:

    [id, type, pre_snapshot, timestamp, user, description,
     cleanup_algorithm, userdata]

    id: dbus.UInt32
    type: dbus.UInt16
    pre_snapshot: dbus.UInt32
    timestamp: dbus.Int64
    user: dbus.UInt32
    description: dbus.String
    cleaup_algorithm: dbus.String
    userdata: dbus.Dictionary
    '''
    data = {}

    data['id'] = snapshot[0]
    data['type'] = ['single', 'pre', 'post'][snapshot[1]]
    if data['type'] == 'post':
        data['pre'] = snapshot[2]

    if snapshot[3] != -1:
        data['timestamp'] = snapshot[3]
    else:
        data['timestamp'] = int(time.time())

    data['user'] = getpwuid(snapshot[4])[0]
    data['description'] = snapshot[5]
    data['cleanup'] = snapshot[6]

    data['userdata'] = {}
    for key, value in snapshot[7].items():
        data['userdata'][key] = value

    return data