<｜begin▁of▁sentence｜>### Instruction:
If you have a complete graph with 5 nodes and you want to generate a LaTeX representation of this graph using the TikZ drawing utility, how would you use NetworkX's `to_latex` function to obtain the LaTeX code? Include a caption 'My Graph' and ensure that the LaTeX code is ready to be compiled by setting 'as_document' to True.
### Response:
import networkx as nx

# Create a simple graph
g = nx.complete_graph(5)

# Generate LaTeX code for the graph
latex_code = nx.drawing.nx_pydot.to_latex(g, pos='neato', tikz_options=None,
                                       default_node_options=None, node_options=None,
                                       node_label=None, default_edge_options=None,
                                       edge_options=None, edge_label=None,
                                       edge_label_options=None, caption='My Graph',
                                       latex_label=None, sub_captions=None,
                                       sub_latex_labels=None, n_rows=1, as_document=True,
                                       document_wrapper=None, figure_wrapper=None,
                                       subfigure_wrapper=None)

# Print the generated LaTeX code
print(latex_code)
<|EOT|>
