def rebuild(filename, tag=None, format="<STR_LIT>", zonegroups=[], metadata=None):
tmpdir = tempfile.mkdtemp()<EOL>zonedir = os.path.join(tmpdir, "<STR_LIT>")<EOL>moduledir = os.path.dirname(__file__)<EOL>try:<EOL><INDENT>with tar_open(filename) as tf:<EOL><INDENT>for name in zonegroups:<EOL><INDENT>tf.extract(name, tmpdir)<EOL><DEDENT>filepaths = [os.path.join(tmpdir, n) for n in zonegroups]<EOL>try:<EOL><INDENT>check_call(["<STR_LIT>", "<STR_LIT>", zonedir] + filepaths)<EOL><DEDENT>except OSError as e:<EOL><INDENT>_print_on_nosuchfile(e)<EOL>raise<EOL><DEDENT><DEDENT>with open(os.path.join(zonedir, METADATA_FN), '<STR_LIT:w>') as f:<EOL><INDENT>json.dump(metadata, f, indent=<NUM_LIT:4>, sort_keys=True)<EOL><DEDENT>target = os.path.join(moduledir, ZONEFILENAME)<EOL>with tar_open(target, "<STR_LIT>" % format) as tf:<EOL><INDENT>for entry in os.listdir(zonedir):<EOL><INDENT>entrypath = os.path.join(zonedir, entry)<EOL>tf.add(entrypath, entry)<EOL><DEDENT><DEDENT><DEDENT>finally:<EOL><INDENT>shutil.rmtree(tmpdir)<EOL><DEDENT>
Rebuild the internal timezone info in dateutil/zoneinfo/zoneinfo*tar*

    filename is the timezone tarball from ftp.iana.org/tz.