<｜begin▁of▁sentence｜>### Instruction:
Given a multigraph G with weighted and unweighted directed edges, how can one represent its adjacency matrix as a SciPy CSR sparse array, ensuring that the matrix accounts for the weights of the edges?
### Response:
import networkx as nx
from scipy.sparse import csr_matrix

# Create a graph
G = nx.MultiDiGraph()
G.add_edge(0, 1, weight=2)
G.add_edge(1, 0)
G.add_edge(2, 2, weight=3)
G.add_edge(2, 2)

# Get the adjacency matrix in CSR format
S = nx.to_scipy_sparse_array(G, nodelist=[0, 1, 2], dtype=float, weight='weight', format='csr')

# Print the adjacency matrix
print(S.toarray())
<|EOT|>
