# How do I write function to test if a graph is apex?

I am working on topological graph theory problems and using SageMath. I want to create a function that give a boolean True or False answer, so I can use this answer for further use. My current function that I use:

```
def is_apex(a):
for v in a.vertex_iterator():
l=a.neighbors(v)
if a.is_planar(a.delete_vertex(v)):
print("Deleting vertex ",v," makes a planar graph")
a.add_vertex(v)
a.add_edges([(v, y) for y in l])
else:
a.add_vertex(v)
a.add_edges([(v, y) for y in l])
print("Deleting vertex ",v," does not make a planar graph")
```

I am a noob when it comes to programming, and any help would be awesome.

I want a True returned if the graph is apex and a False value to return for not apex.

Thoughts?