<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flatten_dist_egginfo_json( source_dists, filename=DEFAULT_JSON, dep_keys=DEP_KEYS, working_set=None):
 """ Flatten a distribution's egginfo json, with the depended keys to be flattened. Originally this was done for this: Resolve a distribution's (dev)dependencies through the working set and generate a flattened version package.json, returned as a dict, from the resolved distributions. Default working set is the one from pkg_resources. The generated package.json dict is done by grabbing all package.json metadata from all parent Python packages, starting from the highest level and down to the lowest. The current distribution's dependencies will be layered on top along with its other package information. This has the effect of child packages overriding node/npm dependencies which is by the design of this function. If nested dependencies are desired, just rely on npm only for all dependency management. Flat is better than nested. """


    working_set = working_set or default_working_set
    obj = {}

    # TODO figure out the best way to explicitly report back to caller
    # how the keys came to be (from which dist).  Perhaps create a
    # detailed function based on this, retain this one to return the
    # distilled results.

    depends = {dep: {} for dep in dep_keys}

    # Go from the earliest package down to the latest one, as we will
    # flatten children's d(evD)ependencies on top of parent's.
    for dist in source_dists:
        obj = read_dist_egginfo_json(dist, filename)
        if not obj:
            continue

        logger.debug("merging '%s' for required '%s'", filename, dist)
        for dep in dep_keys:
            depends[dep].update(obj.get(dep, {}))

    if obj is None:
        # top level object does not have egg-info defined
        return depends

    for dep in dep_keys:
        # filtering out all the nulls.
        obj[dep] = {k: v for k, v in depends[dep].items() if v is not None}

    return obj