import pickle


def debrine(filename, encoding='latin1'):
    """pickle.load(open(filename))

    Use encoding='latin1' to load datetime, numpy, or scikit objects pickled in
    Python 2 in Python 3. (Latin-1 works for any input as it maps the byte
    values 0-255 to the first 256 Unicode codepoints directly:
    https://stackoverflow.com/questions/28218466/unpickling-a-python-2-object-with-python-3/28218598#28218598
    )
    """
    obj = None
    with open(filename, 'rb') as f:
        try:
            obj = pickle.load(f, encoding=encoding)  # Python 3
        except Exception:
            obj = pickle.load(f)   # Python 2
    return obj