<｜begin▁of▁sentence｜>### Instruction:
Can you create a tree using the random_powerlaw_tree function with 10 nodes, where the degree distribution follows a power law with an exponent of 3? Additionally, set a seed for reproducibility and limit the number of attempts to generate a valid tree to 100.
### Response:
import networkx as nx

# Generate a random powerlaw tree
n = 10  # number of nodes
gamma = 3  # exponent of the power law
seed = 42  # seed for random number generator
tries = 100  # number of attempts to get a valid tree

try:
    tree = nx.random_powerlaw_tree(n, gamma, seed=seed, tries=tries)
    print(nx.info(tree))
except nx.NetworkXError as e:
    print('Failed to generate a valid powerlaw tree:', e)
<|EOT|>
