<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_dist_dependencies(name, recurse=True):
 """ Get the dependencies of the given, already installed distribution. @param recurse If True, recursively find all dependencies. @returns A set of package names. @note The first entry in the list is always the top-level package itself. """

    dist = pkg_resources.get_distribution(name)
    pkg_name = convert_name(dist.project_name)

    reqs = set()
    working = set([dist])
    depth = 0

    while working:
        deps = set()
        for distname in working:
            dist = pkg_resources.get_distribution(distname)
            pkg_name = convert_name(dist.project_name)
            reqs.add(pkg_name)

            for req in dist.requires():
                reqs_ = convert_requirement(req)
                deps |= set(x.split('-', 1)[0] for x in reqs_
                            if not x.startswith('!'))

        working = deps - reqs
        depth += 1
        if (not recurse) and (depth >= 2):
            break

    return reqs