import pickle


def _pickle(pickle_file):
    """
    Loads a pickle file that works in both py 2 and 3

    Parameters
    ------
    pickle_file : str
        path to pickle file to load
    """
    try:
        with open(pickle_file.as_posix(), "rb") as f:
            return pickle.load(f)
    except UnicodeDecodeError:
        with open(pickle_file.as_posix(), "rb") as f:
            return pickle.load(f, encoding="latin1")