<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_egginfo_json( pkg_names, filename=DEFAULT_JSON, dep_keys=DEP_KEYS, working_set=None):
 """ A shorthand calling convention where the package name is supplied instead of a distribution. Originally written for this: Generate a flattened package.json with packages `pkg_names` that are already installed within the current Python environment (defaults to the current global working_set which should have been set up correctly by pkg_resources). """


    working_set = working_set or default_working_set
    # Ensure only grabbing packages that exists in working_set
    dists = find_packages_requirements_dists(
        pkg_names, working_set=working_set)
    return flatten_dist_egginfo_json(
        dists, filename=filename, dep_keys=dep_keys, working_set=working_set)