from pathlib import Path
import pickle


def load_trained_model(fname: str):
    """
    Loads a saved ModelData object from file.

    Args:
        fname (str): Complete path to the file.

    Returns: A ModelData object containing the model, list of titles, list of
        authors, list of genres, list of summaries, training corpus, and test
        corpus.

    """

    fp = Path(fname)

    with fp.open("rb") as f:
        model_data = pickle.load(f)
    return model_data