code: def is_almost_simplicial(G, n):
      
      for w in G[n]:
          if all(u in G[v] for u, v in itertools.combinations(G[n], 2) if u != w and v != w):
              return True
      return False
docs: Determines whether a node n in G is almost simplicial.
  
      Parameters
      ----------
      G : NetworkX graph
          The graph on which to check whether node n is almost simplicial.
      n : node
          A node in graph G.
  
      Returns
      -------
      is_almost_simplicial : bool
          True if all but one of its neighbors induce a clique
  
      Examples
      --------
      This example checks whether node 0 is simplicial or almost simplicial for
      a :math:`K_5` complete graph with one edge removed.
  
      >>> import dwave_networkx as dnx
      >>> import networkx as nx
      >>> K_5 = nx.complete_graph(5)
      >>> K_5.remove_edge(1,3)
      >>> dnx.is_simplicial(K_5, 0)
      False
      >>> dnx.is_almost_simplicial(K_5, 0)
      True