<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bitstring_probs_to_z_moments(p):
 """ Convert between bitstring probabilities and joint Z moment expectations. :param np.array p: An array that enumerates bitstring probabilities. When therefore be a power of 2. The canonical shape has a separate axis for each qubit, such that :return: ``z_moments``, an np.array with one length-2 axis per qubit which contains the monomial can be accessed via:: :rtype: np.array """

    zmat = np.array([[1, 1],
                     [1, -1]])
    return _apply_local_transforms(p, (zmat for _ in range(p.ndim)))