if not options.datfile.endswith(".dat"):
    print "Datfile doesn't end with .dat: %s" % (options.datfile)
    sys.exit(1)