def get_living_neighbors(i, j, generation):
    """
    returns living neighbors around the cell
    """
    living_neighbors = 0 # count for living neighbors
    neighbors = [(i-1, j), (i+1, j), (i, j-1), (i, j+1),
                    (i-1, j+1), (i-1, j-1), (i+1, j+1), (i+1, j-1)] 
    for k, l in neighbors:
        if 0 <= k < len(generation) and 0 <= l < len(generation[0]):
            if generation[k][l] == 1:
                living_neighbors += 1
    return living_neighbors