Extracts a TAR archive. All element names starting with ``/`` (indicating an absolute path) or that contain ``..``
    as references to a parent directory are not extracted.

    :param filename: Path to the tar file.
    :type filename: unicode
    :param dest_path: Destination path to extract the contents to.
    :type dest_path: unicode
    :param kwargs: Additional kwargs for opening the TAR file (:func:`tarfile.open`).

def extract_tar(filename, dest_path, **kwargs):
    """
    Extracts a TAR archive. All element names starting with ``/`` (indicating an absolute path) or that contain ``..``
    as references to a parent directory are not extracted.

    :param filename: Path to the tar file.
    :type filename: unicode
    :param dest_path: Destination path to extract the contents to.
    :type dest_path: unicode
    :param kwargs: Additional kwargs for opening the TAR file (:func:`tarfile.open`).
    """
    with tarfile.open(filename, 'r', **kwargs) as tf:
        safe_members = [name for name in tf.getmembers() if _safe_name(name)]
        if safe_members:
            tf.extractall(dest_path, safe_members)