<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def module2package(mod, dist, pkg_map=None, py_vers=('py',)):
 """Return a corresponding package name for a python module. mod: python module name dist: a linux distribution as returned by `platform.linux_distribution()[0]` pkg_map: a custom package mapping. None means autodetected based on the given dist parameter py_vers: a list of python versions the function should return. Default is 'py' which is the unversioned translation. Possible values are 'py', 'py2' and 'py3' """

    if not pkg_map:
        pkg_map = get_pkg_map(dist)
    for rule in pkg_map:
        pkglist = rule(mod, dist)
        if pkglist:
            break
    else:
        tr_func = get_default_tr_func(dist)
        pkglist = tr_func(mod)

    output = []
    for v in py_vers:
        if v == 'py':
            output.append(pkglist[0])
        elif v == 'py2':
            output.append(pkglist[1])
        elif v == 'py3':
            output.append(pkglist[2])
        else:
            raise Exception('Invalid version "%s"' % (v))

    if len(output) == 1:
        # just return a single value (backwards compatible)
        return output[0]
    else:
        return output