import _lzma
import _pickle


def pickle(object, filename):
    """Save an object to a .xz compressed pickle file."""
    with _lzma.open(filename, "wb") as file:
        return _pickle.dump(object, file)