def export_bert(data, electrodes, filename):
    if has_multiple_timesteps(data):
        for i, timestep in enumerate(split_timesteps(data)):
            export_bert(timestep, electrodes,
                        filename.replace(".", "_%.3d." % i))
    f = open(filename, 'w')
    f.write("%d\n" % len(electrodes))
    f.write("
    electrodes = electrodes.copy()
    data = data.copy()
    electrodes.columns = electrodes.columns.str.lower()
    data.columns = data.columns.str.lower()
    cols_to_export = ["a", "b", "m", "n", "u", "i", "r", "rho_a", "error"]
    data.drop(data.columns.difference(cols_to_export), 1, inplace=True)
    data.rename(columns={"rho_a": "rhoa", "error": "err"}, inplace=True)
    for key in electrodes.keys():
        f.write("%s " % key)
    f.write("\n")
    for row in electrodes.itertuples(index=False):
        for val in row:
            f.write("%5.3f " % val)
        f.write("\n")
    f.write("%d\n" % len(data))
    f.write("
    columns = data.columns.tolist()
    for c in "abmn":
        columns.remove(c)
    columns = list("abmn") + columns
    data = data[columns]
    for key in data.keys():
        f.write("%s " % key)
    f.write("\n")
    for row in data.itertuples(index=False):
        for i, val in enumerate(row):
            if i < 4:
                f.write("%d " % val)
            else:
                f.write("%E " % val)
        f.write("\n")
    f.close()