import pickle


def load_model(filename):
    """
    Function to load an HMM model from a pickle file.

    :param filename: full path or just file name where to save the variable
    :type filename: str
    :return: the trained HMM that was in the file
    :rtype: object
    """
    with open(filename, 'rb') as f:
        model = pickle.load(f)
    return model