<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def to_networkx_graph(self, node_attribute_name='bias', edge_attribute_name='bias'):
 """Convert a binary quadratic model to NetworkX graph format. Args: node_attribute_name (hashable, optional, default='bias'):
 Attribute name for linear biases. edge_attribute_name (hashable, optional, default='bias'):
 Attribute name for quadratic biases. Returns: :class:`networkx.Graph`: A NetworkX graph with biases stored as node/edge attributes. Examples: This example converts a binary quadratic model to a NetworkX graph, using first the default attribute name for quadratic biases then "weight". 0.5 1 0.5 """

        import networkx as nx

        BQM = nx.Graph()

        # add the linear biases
        BQM.add_nodes_from(((v, {node_attribute_name: bias, 'vartype': self.vartype})
                            for v, bias in iteritems(self.linear)))

        # add the quadratic biases
        BQM.add_edges_from(((u, v, {edge_attribute_name: bias}) for (u, v), bias in iteritems(self.quadratic)))

        # set the offset and vartype properties for the graph
        BQM.offset = self.offset
        BQM.vartype = self.vartype

        return BQM