def module2package(mod, dist, pkg_map=None, py_vers=('<STR_LIT>',)):
if not pkg_map:<EOL><INDENT>pkg_map = get_pkg_map(dist)<EOL><DEDENT>for rule in pkg_map:<EOL><INDENT>pkglist = rule(mod, dist)<EOL>if pkglist:<EOL><INDENT>break<EOL><DEDENT><DEDENT>else:<EOL><INDENT>tr_func = get_default_tr_func(dist)<EOL>pkglist = tr_func(mod)<EOL><DEDENT>output = []<EOL>for v in py_vers:<EOL><INDENT>if v == '<STR_LIT>':<EOL><INDENT>output.append(pkglist[<NUM_LIT:0>])<EOL><DEDENT>elif v == '<STR_LIT>':<EOL><INDENT>output.append(pkglist[<NUM_LIT:1>])<EOL><DEDENT>elif v == '<STR_LIT>':<EOL><INDENT>output.append(pkglist[<NUM_LIT:2>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>' % (v))<EOL><DEDENT><DEDENT>if len(output) == <NUM_LIT:1>:<EOL><INDENT>return output[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>return output<EOL><DEDENT>
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'