code: def nodes_by_attribute(self, attr_val, attr='type'):
          
  
          temp_nodes = getattr(self, 'node')
          nodes = list(filter(None, map(lambda x: x if temp_nodes[x][attr] == attr_val else None,
                                        temp_nodes.keys())))
  
          return nodes
docs: Select Graph's nodes by attribute value
  
          Get all nodes that share the same attribute. By default, the attr 'type'
          is used to specify the nodes type (generator, load, etc.).
  
          Examples
          --------
          >>> import edisgo
          >>> G = edisgo.grids.Graph()
          >>> G.add_node(1, type='generator')
          >>> G.add_node(2, type='load')
          >>> G.add_node(3, type='generator')
          >>> G.nodes_by_attribute('generator')
          [1, 3]
  
          Parameters
          ----------
          attr_val: str
              Value of the `attr` nodes should be selected by
          attr: str, default: 'type'
              Attribute key which is 'type' by default
  
          Returns
          -------
          list
              A list containing nodes elements that match the given attribute
              value