code: def _slow_bwperim(bwimg, n=4):
      r, c = bwimg.shape
      res = np.zeros_like(bwimg)
      for y in range(r):
          for x in range(c):
              res[y, x] = bwimg[y, x] and np.any(
                  ~_neighbours(bwimg, y, x, n)
              )
      return res
  
imports: from mahotas import bwperim
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: _slow_bwperim(bwimg, n) and returns: res