human
Complete this python program:
def make_tar(tfn, source_dirs, ignore_path=[]):
assistant
#Here is the Python code you requested.

    """Make a zip file `fn` from the contents of source_dis.
    """
    def select(fn):
        rfn = realpath(fn)
        for p in ignore_path:
            if p.endswith('/'):
                p = p[:(-1)]
            if rfn.startswith(p):
                return False
        if (rfn in python_files):
            return False
        return (not is_blacklist(fn))
    files = []
    for sd in source_dirs:
        sd = realpath(sd)
        compile_dir(sd)
        files += [(x, relpath(realpath(x), sd)) for x in listfiles(sd) if select(x)]
    tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT)
    dirs = []
    for (fn, afn) in files:
        dn = dirname(afn)
        if (dn not in dirs):
            d = ''
            for component in split(dn):
                d = join(d, component)
                if d.startswith('/'):
                    d = d[1:]
                if ((d == '') or (d in dirs)):
                    continue
                dirs.append(d)
                tinfo = tarfile.TarInfo(d)
                tinfo.type = tarfile.DIRTYPE
                tf.addfile(tinfo)
        tf.add(fn, afn)
    tf.close()