code: def _export_graph_to_graph_tool(
      graph,
      graph_attributes=None,
      vertex_attributes=None,
      edge_attributes=None,
  ):
      """Converts the graph to graph-tool
  
      Data types: graph-tool only accepts specific data types. See the
      following web page for a list:
  
      https://graph-tool.skewed.de/static/doc/quickstart.html
  
      Note: because of the restricted data types in graph-tool, vertex and
      edge attributes require to be type-consistent across all vertices or
      edges. If you set the property for only some vertices/edges, the other
      will be tagged as None in igraph, so they can only be converted
      to graph-tool with the type 'object' and any other conversion will
      fail.
  
      @param graph_attributes: dictionary of graph attributes to transfer.
        Keys are attributes from the graph, values are data types (see
        below). C{None} means no graph attributes are transferred.
      @param vertex_attributes: dictionary of vertex attributes to transfer.
        Keys are attributes from the vertices, values are data types (see
        below). C{None} means no vertex attributes are transferred.
      @param edge_attributes: dictionary of edge attributes to transfer.
        Keys are attributes from the edges, values are data types (see
        below). C{None} means no vertex attributes are transferred.
      """
      import graph_tool as gt
  
      # Graph
      g = gt.Graph(directed=graph.is_directed())
  
      # Nodes
      vc = graph.vcount()
      g.add_vertex(vc)
  
      # Graph attributes
      if graph_attributes is not None:
          for x, dtype in graph_attributes.items():
              # Strange syntax for setting internal properties
              gprop = g.new_graph_property(str(dtype))
              g.graph_properties[x] = gprop
              g.graph_properties[x] = graph[x]
  
      # Vertex attributes
      if vertex_attributes is not None:
          for x, dtype in vertex_attributes.items():
              # Create a new vertex property
              g.vertex_properties[x] = g.new_vertex_property(str(dtype))
              # Fill the values from the igraph.Graph
              for i in range(vc):
                  g.vertex_properties[x][g.vertex(i)] = graph.vs[i][x]
  
      # Edges and edge attributes
      if edge_attributes is not None:
          for x, dtype in edge_attributes.items():
              g.edge_properties[x] = g.new_edge_property(str(dtype))
      for edge in graph.es:
          e = g.add_edge(edge.source, edge.target)
          if edge_attributes is not None:
              for x in edge_attributes.keys():
                  prop = edge.attributes().get(x, None)
                  g.edge_properties[x][e] = prop
  
      return g
  
label_desc: Use image node_id 3 for calling a global function with example usage: _export_graph_to_graph_tool(graph, graph_attributes, vertex_attributes, edge_attributes) and returns: g