import pickle


def unpickle_from_disk(filename):
    """Unpickle an object from disk.

    Requires a complete filename      
    Passes Exception if file could not be loaded.
    """
    # Warning: only using 'r' or 'w' can result in EOFError when unpickling! 
    try:
        with open(filename, "rb") as pickle_file:
            obj = pickle.load(pickle_file)
    except UnicodeDecodeError as e:
        with open(filename, "rb") as pickle_file:
            obj = pickle.load(pickle_file, encoding='latin1')
    except Exception as e:
        print('Unable to load data ', filename, ':', e)
        raise
    return obj