<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def two_swap_helper(j, k, num_qubits, qubit_map):
 """ Generate the permutation matrix that permutes two single-particle Hilbert spaces into adjacent positions. ALWAYS swaps j TO k. Recall that Hilbert spaces are ordered in decreasing qubit index order. Hence, j > k implies that j is to the left of k. End results: j == k: nothing happens j > k: Swap j right to k, until j at ind (k) and k at ind (k+1). j < k: Swap j left to k, until j at ind (k) and k at ind (k-1). Done in preparation for arbitrary 2-qubit gate application on ADJACENT qubits. :param int j: starting qubit index :param int k: ending qubit index :param int num_qubits: number of qubits in Hilbert space :param np.array qubit_map: current index mapping of qubits :return: tuple of swap matrix for the specified permutation, and the new qubit_map, after permutation is made :rtype: tuple (np.array, np.array) """

    if not (0 <= j < num_qubits and 0 <= k < num_qubits):
        raise ValueError("Permutation SWAP index not valid")

    perm = np.eye(2 ** num_qubits, dtype=np.complex128)
    new_qubit_map = np.copy(qubit_map)

    if j == k:
        # nothing happens
        return perm, new_qubit_map
    elif j > k:
        # swap j right to k, until j at ind (k) and k at ind (k+1)
        for i in range(j, k, -1):
            perm = qubit_adjacent_lifted_gate(i - 1, SWAP, num_qubits).dot(perm)
            new_qubit_map[i - 1], new_qubit_map[i] = new_qubit_map[i], new_qubit_map[i - 1]
    elif j < k:
        # swap j left to k, until j at ind (k) and k at ind (k-1)
        for i in range(j, k, 1):
            perm = qubit_adjacent_lifted_gate(i, SWAP, num_qubits).dot(perm)
            new_qubit_map[i], new_qubit_map[i + 1] = new_qubit_map[i + 1], new_qubit_map[i]

    return perm, new_qubit_map