def extract_tar(source_path, destination_path, compression_type='gz'):
    """
    :param source_path:
    :param destination_path:
    :param compression_type: None, gz or bzip2
    :return:
    """
    mode = 'r:{}'.format(compression_type if compression_type else 'r')
    with tarfile.open(source_path, mode) as fh:
        fh.extractall(path=destination_path)

    :param source_path:
    :param destination_path:
    :param compression_type: None, gz or bzip2
    :return:
    
cakechat/utils/files_utils.py