def draw_to_file(layers, filename, **kwargs):
 layers = (layers.get_all_layers() if hasattr(layers, 'get_all_layers') else layers)
 dot = make_pydot_graph(layers, **kwargs)
 ext = filename[(filename.rfind('.') + 1):]
 with io.open(filename, 'wb') as fid:
  fid.write(dot.create(format=ext))

def draw_to_file ( layers , filename , ** kwargs ) : layers = ( layers . get_all_layers ( ) if hasattr ( layers , 'get_all_layers' ) else layers ) dot = make_pydot_graph ( layers , ** kwargs ) ext = filename [ ( filename . rfind ( '.' ) + 1 ) : ] with io . open ( filename , 'wb' ) as fid : fid . write ( dot . create ( format = ext ) )
draws a network diagram to a file .