import pickle


def save_obj(obj, file):
    """
    Dump an object with pickle.
    Be aware that pickle is version dependent,
    i.e. objects dumped in Py3 cannot be loaded with Py2.
    """
    try:
        with open(file, "wb") as f:
            pickle.dump(obj, f)
        print("Object saved to {}".format(file))
        return True
    except:
        print("Error: Object not saved...")
        return False