<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pack_container(in_container, out_file):
 """ Pack a container image into a .tar.bz2 archive. Args: in_container (str):
 Path string to the container image. out_file (str):
 Output file name. """

    container_filename = local.path(out_file).basename
    out_container = local.cwd / "container-out" / container_filename
    out_dir = out_container.dirname

    # Pack the results to: container-out
    with local.cwd(in_container):
        tar("cjf", out_container, ".")
    c_hash = download.update_hash(out_container)
    if out_dir.exists():
        mkdir("-p", out_dir)
    mv(out_container, out_file)
    mv(out_container + ".hash", out_file + ".hash")

    new_container = {"path": out_file, "hash": str(c_hash)}
    CFG["container"]["known"] += new_container