import gzip
import pickle


def write_pickle(obj: object, path: str, *args, **kwargs) -> str:
    """Pickle a Python object and compress with Gzip.

    Any additional arguments and keyword arguments are passed to :func:`pickle.dump`.

    Args:
        obj: Object to pickle
        path: Path to save pickle

    Returns:
        Saved pickle path
    """
    with gzip.open(path, 'wb') as f:
        pickle.dump(obj, f, *args, **kwargs)
    return path