<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_outdated(dist, dep=False):
 """Return a dict with outdated distributions If the given distribution has dependencies, they are checked as well. :param dist: a distribution to check :type dist: :class:`pkg_resources.Distribution` | str :param dep: If True, also return all outdated dependencies. If False, only check given dist. :type dep: :returns: dictionary of all distributions that are outdated and are either dependencies of the given distribution or the distribution itself. Keys are the outdated distributions and values are the newest parsed versions. :rtype: dict of :class:`pkg_resources.Distribution` :raises: class:`pkg_resources.DistributionNotFound` """

    if dep:
        required = get_required(dist)
    else:
        required = set([dist])
    ListCommand = pip.commands['list']
    lc = ListCommand()
    options, args = lc.parse_args(['--outdated'])
    outdated = {}
    for d, raw_ver, parsed_ver in lc.find_packages_latests_versions(options):
        for r in required:
            if d.project_name == r.project_name and parsed_ver > r.parsed_version:
                outdated[r] = parsed_ver
    return outdated