code: def _tar_and_copy(src_dir, target_dir):
    
    src_dir = src_dir.rstrip("/")
    target_dir = target_dir.rstrip("/")
    tmp_dir = tempfile.gettempdir().rstrip("/")
    src_base = os.path.basename(src_dir)
    shell_run(
        "tar --exclude=.git -zcf {tmp_dir}/{src_base}.tar.gz -C {src_dir} .",
        src_dir=src_dir,
        src_base=src_base,
        tmp_dir=tmp_dir)
    final_destination = "%s/%s.tar.gz" % (target_dir, src_base)
    shell_run(
        ("gsutil cp {tmp_dir}/{src_base}.tar.gz "
         "{final_destination}"),
        tmp_dir=tmp_dir,
        src_base=src_base,
        final_destination=final_destination)
    return final_destination
docs: Tar and gzip src_dir and copy to GCS target_dir.