<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def neighbors(self, n, t=None):
 """Return a list of the nodes connected to the node n at time t. Parameters n : node A node in the graph t : snapshot id (default=None) If None will be returned the neighbors of the node on the flattened graph. Returns ------- nlist : list A list of nodes that are adjacent to n. Raises ------ NetworkXError If the node n is not in the graph. Examples -------- [1] [] """

        try:
            if t is None:
                return list(self._adj[n])
            else:
                return [i for i in self._adj[n] if self.__presence_test(n, i, t)]
        except KeyError:
            raise nx.NetworkXError("The node %s is not in the graph." % (n,))