def get_png_data_poset(library, name, x, data_format):
    if isinstance(x, FinitePoset):
        import mcdp_report.my_gvgen as gvgen
        direction = 'TB'
        assert direction in ['LR', 'TB']
        gg = gvgen.GvGen(options="rankdir=%s" % direction)
        
        e2n = {}
        for e in x.elements:
            n = gg.newItem(e)
            e2n[e] = n
            gg.propertyAppend(n, "shape", "none")
        
        
        for e1, e2 in x.relations:
            # check if e2 is minimal
            all_up = set(_ for _ in x.elements if x.leq(e1, _) and not x.leq(_, e1))
            
            minimals = poset_minima(all_up, x.leq)
            
            if not e2 in minimals:
                continue
            
            low = e2n[e1]
            high = e2n[e2]
            l = gg.newLink(high, low )
            gg.propertyAppend(l, "arrowhead", "none")
            gg.propertyAppend(l, "arrowtail", "none")
            
        data, = gg_get_formats(gg, (data_format,))
        return data
    else:
        s = str(x)
        return create_image_with_string(s, size=(512, 512), color=(128, 128, 128))
def get_png_data_unavailable(library, name, x, data_format):  # @UnusedVariable
    s = str(x)
    return create_image_with_string(s, size=(512, 512), color=(0, 0, 255))