code: def estimate_bitstring_probs(results):
      
      nshots, nq = np.shape(results)
      outcomes = np.array([int("".join(map(str, r)), 2) for r in results])
      probs = np.histogram(outcomes, bins=np.arange(-.5, 2 ** nq, 1))[0] / float(nshots)
      return _bitstring_probs_by_qubit(probs)
docs: Given an array of single shot results estimate the probability distribution over all bitstrings.
  
      :param np.array results: A 2d array where the outer axis iterates over shots
          and the inner axis over bits.
      :return: An array with as many axes as there are qubit and normalized such that it sums to one.
          ``p[i,j,...,k]`` gives the estimated probability of bitstring ``ij...k``.
      :rtype: np.array