import pickle


def load_model(path):
    """Loads the saved BaseModel and returns the reconstructed object.

    Parameters
    ----------
    path: string
        Location of the saved model.

    Returns
    -------
    model: BaseModel
        Saved BaseModel/child class instance."""
    with open(path, 'rb') as f:
        model = pickle.load(f)
    try:
        for m in model.models:
            m._parameters._prefix = m._prefix
    except:
        model._parameters._prefix = model._prefix
    return model