def get_hamming_distance(M1, M2):
    """
    Gets the number of dis-similar entries betweeen two numpy arrays.
    Here the application is for boolean numpy array, whichis why this metric
    is actually hamming distance. Since this comparison is element-wise, the
    number of entries in each array needs to be equal.

    Parameters
    ----------
    M1 : numpy.array
        Boolean numpy array of arbitrary dimensions. Could be a 1-d, 2-d
        array (matrix) or higher order (tensor).
    M2 : numpy.array
        Boolean numpy array of arbitrary dimensions. Could be a 1-d, 2-d
        array (matrix) or higher order (tensor).

    Returns
    -------
    ham : int
        Number of unequal elements between the two boolean numpy arrays.

    """

    ham = 0
    vec1 = list(M1.ravel())
    vec2 = list(M2.ravel())
    assert len(vec1) == len(vec2)
    for i in range(len(vec1)):
        if vec1[i] != vec2[i]:
            ham += 1
    return ham