<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tar_dir(tarfile, srcdir):
 """ Pack a tar file using all the files in the given srcdir """

    files = os.listdir(srcdir)
    packtar(tarfile, files, srcdir)