def export_pickle(data, filename='test.dat', compress=False):

    fh = None
    try:
        if compress:
            fh = gzip.open(filename, "wb") # write binary
        else:
            fh = open(filename, "wb") # compact binary pickle format
            pickle.dump(data, fh, pickle.HIGHEST_PROTOCOL)

    except(EnvironmentError, pickle.PickingError) as err:
        print("{0}: export error: {1}".format(os.path.basename(sys.argv[0], err)))
        return False

    finally:
        if fh != None:
            fh.close()
dataset/ETHPy150Open bt3gl/Python-and-Algorithms-and-Data-Structures/src/USEFUL/basic_examples/example_pickle.py/export_pickle/operator `is not` -> `!=`