def setup_keyring(keyring_name):
    '''Setup the keyring'''
    keyring_path = os.path.join("test", "outputdata", keyring_name)
    # Delete the entire keyring
    shutil.rmtree(keyring_path, ignore_errors=True)
    os.makedirs(keyring_path)
    gpg = GPG(gnupghome=keyring_path, gpgbinary="gpg")
    for key_name in ["key1_private", "key1_public"]:
        with open(os.path.join("test", "inputdata", key_name + ".txt"), "r") as keyfile:
            key_str = "".join(keyfile.readlines())
        import_result = gpg.import_keys(key_str)
        print("Import result:", type(import_result))
        print(import_result.__dict__)
        if import_result.count == 1 and len(set(import_result.fingerprints)) == 1:
            print("Got one import result")
    return gpg
def mesh(isa, with_axis=False, ax=0):
    """plot mesh of I7/ISA7 model
    Args:
      isa: Isa7 object
    """
    from matplotlib.lines import Line2D
    if ax == 0:
        ax = plt.gca()
    ax.set_aspect('equal')
    for el in isa.elements:
        pts = [list(i) for i in zip(*[v.xy for v in el.vertices])]
        ax.add_line(Line2D(pts[0], pts[1], color='b', ls='-', lw=0.25))

    # for nc in isa.nodechains:
    #    pts = [list(i) for i in zip(*[(n.x, n.y) for n in nc.nodes])]
    #    ax.add_line(Line2D(pts[0], pts[1], color="b", ls="-", lw=0.25,
    #                       marker=".", ms="2", mec="None"))

    # for nc in isa.nodechains:
    #    if nc.nodemid is not None:
    #        plt.plot(*nc.nodemid.xy, "rx")

    ax.autoscale(enable=True)
    if not with_axis:
        ax.axis('off')