def _to_chimera(M, N, L, q):
    "Converts a qubit's linear index to chimera coordinates."
    return (q // N // L // 2, (q // L // 2) % N, (q // L) % 2, q % L)
Converts a qubit's linear index to chimera coordinates.