from pathlib import Path
import zipfile


def unzip_pyspin(source_file=None, destination_dir=None):
    """Unzip the pyspin library
    """
    if source_file is None:
        source_file = Path().home() / "Downloads" / "pyspin.zip"
    else:
        source_file = Path(source_file)
    if destination_dir is None:
        destination_dir = source_file.parent / source_file.stem
        if not destination_dir.exists():
            destination_dir.mkdir()


    print("Unzipping pyspin...")
    with zipfile.ZipFile(source_file, 'r') as zip_ref:
        zip_ref.extractall(destination_dir)

    return destination_dir