def generate_neighbours(pattern: str, mismatches: int) -> set:
    "\n    Generate neighbours for the given pattern (genome string)\n    :param pattern: genome pattern\n    :param mismatches: number of mismatches to generate neighbours\n    :return: a set of patterns in the neighbourhood, including the 'pattern' itself\n    "
    neighbourhood = set()
    neighbourhood.add(pattern)
    curr_patterns = [pattern]
    next_patterns = []
    for curr_mismatches in range(mismatches):
        for curr_pattern in curr_patterns:
            for neighbour in _generate_immediate_neighbours(curr_pattern):
                if (neighbour not in neighbourhood):
                    neighbourhood.add(neighbour)
                    next_patterns.append(neighbour)
        curr_patterns = next_patterns
        next_patterns = []
    return neighbourhood
Generate neighbours for the given pattern (genome string)
:param pattern: genome pattern
:param mismatches: number of mismatches to generate neighbours
:return: a set of patterns in the neighbourhood, including the 'pattern' itself
def generate_neighbours(pattern: str, mismatches: int) -> set:
    "\n    Generate neighbours for the given pattern (genome string)\n    :param pattern: genome pattern\n    :param mismatches: number of mismatches to generate neighbours\n    :return: a set of patterns in the neighbourhood, including the 'pattern' itself\n    "
    neighbourhood = set()
    neighbourhood.add(pattern)
    curr_patterns = [pattern]
    next_patterns = []
    for curr_mismatches in range(mismatches):
        for curr_pattern in curr_patterns:
            for neighbour in _generate_immediate_neighbours(curr_pattern):
                if (neighbour not in neighbourhood):
                    neighbourhood.add(neighbour)
                    next_patterns.append(neighbour)
        curr_patterns = next_patterns
        next_patterns = []
    return neighbourhood