import pickle


def load_pickled_data(file_path):
    """Loads a pickled file. Tries to be python2/3 compatible
    
    Args:
        file_path (string): Input filepath
        
    Return:
        loaded_obj (any): Data which was loaded from file
    """
    with open(file_path, "rb") as f:
        try:
            # Python3
            loaded_obj = pickle.load(f,
                        fix_imports=True,
                        encoding="bytes")
        except TypeError:
            # Python2
            loaded_obj = pickle.load(f)
    return loaded_obj