<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def apply_groupby(records, fn, skip_none=False):
 """ Given a list of objects, group them into a dictionary by applying fn to each one and using returned values as a dictionary key. Parameters records : list fn : function skip_none : bool If False, then None can be a key in the returned dictionary, otherwise records whose key value is None get skipped. Returns dict. """


    # create an empty list for every new key
    groups = defaultdict(list)
    for record in records:
        value = fn(record)
        if value is not None or not skip_none:
            groups[value].append(record)
    return dict(groups)