<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def activities_by_target(activities):
 """Get back lists of activities in a dict keyed by ChEMBL target id Parameters activities : list response from a query returning activities for a drug Returns ------- targ_act_dict : dict dictionary keyed to ChEMBL target ids with lists of activity ids """

    targ_act_dict = defaultdict(lambda: [])
    for activity in activities:
        target_chembl_id = activity['target_chembl_id']
        activity_id = activity['activity_id']
        targ_act_dict[target_chembl_id].append(activity_id)
    for target_chembl_id in targ_act_dict:
        targ_act_dict[target_chembl_id] = \
            list(set(targ_act_dict[target_chembl_id]))
    return targ_act_dict