<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_closed(self):
 """ Are all entities connected to other entities. Returns closed : bool Every entity is connected at its ends """

        closed = all(i == 2 for i in
                     dict(self.vertex_graph.degree()).values())

        return closed