<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with multiple edges and potential self-loops, convert the graph to an adjacency matrix as a CSR (Compressed Sparse Row) format SciPy sparse array, using the 'to_scipy_sparse_array' function provided by NetworkX. The graph contains weighted edges, with weights specified by the 'weight' attribute.
### Response:
import networkx as nx

# Create a MultiDiGraph
G = nx.MultiDiGraph()

# Add weighted edges
G.add_edge(0, 1, weight=2)
G.add_edge(1, 0)
G.add_edge(2, 2, weight=3)
G.add_edge(2, 2)

# Convert to a SciPy sparse array with specified nodelist and format
S = nx.to_scipy_sparse_array(G, nodelist=[0, 1, 2], format='csr')

# Print the sparse array
print(S.toarray())
<|EOT|>
