code: def expand_tarball(tarball_fname,cwd=None):
      "expand a tarball"
      if tarball_fname.endswith('.gz'): opts = 'xzf'
      elif tarball_fname.endswith('.bz2'): opts = 'xjf'
      else: opts = 'xf'
      args = ['/bin/tar',opts,tarball_fname]
      process_command(args, cwd=cwdf expand_tarball(tarball_fname,cwd=None):
      "expand a tarball"
      if tarball_fname.endswith('.gz'): opts = 'xzf'
      elif tarball_fname.endswith('.bz2'): opts = 'xjf'
      else: opts = 'xf'
      args = ['/bin/tar',opts,tarball_fname]
      process_command(args, cwd=cwd)
docs: expand a tarball