def hamming_distance(pattern1, pattern2):
    """Return the hamming distance between 2 patterns."""
    if len(pattern1) == len(pattern2):
        return sum([
            pattern1[index] != pattern2[index]
            for index in range(len(pattern1))
        ])
    raise Exception('Length of both reads do not match')