You can test if $G_1\cong G_2$ using the following function f.
sage: f = lambda g,h: g.is_isomorphic(h)

If you really want to use the canonical label then, given a Graph g, you can obtain it by using g.canonical_label() and then just compare the adjacency matrices.