def write_graph(self, filename):
        """Writes the graph to the file with format based on file extension
        """
        _, ext = os.path.splitext(filename)
        try:
            format = self.supported_formats[ext.lower()]
        except __HOLE__:
            raise ValueError("No format could be found for the extension '%s'. " \
                             "The supported formats are [%s]" %
                             (ext, ', '.join(self.supported_formats.keys())))

        write_fn = getattr(nx, 'write_%s' % format)
        write_fn(self, filename)
dataset/ETHPy150Open croach/pydata2013/govtrack.py/Graph.write_graph