code: def _remove_edge(im, r):
      r'''
      Fill in the edges of the input image.
      Used by RSA to ensure that no elements are placed too close to the edge.
      '''
      edge = sp.ones_like(im)
      if len(im.shape) == 2:
          sx, sy = im.shape
          edge[r:sx-r, r:sy-r] = im[r:sx-r, r:sy-r]
      else:
          sx, sy, sz = im.shape
          edge[r:sx-r, r:sy-r, r:sz-r] = im[r:sx-r, r:sy-r, r:sz-r]
      return edgf _remove_edge(im, r):
      r'''
      Fill in the edges of the input image.
      Used by RSA to ensure that no elements are placed too close to the edge.
      '''
      edge = sp.ones_like(im)
      if len(im.shape) == 2:
          sx, sy = im.shape
          edge[r:sx-r, r:sy-r] = im[r:sx-r, r:sy-r]
      else:
          sx, sy, sz = im.shape
          edge[r:sx-r, r:sy-r, r:sz-r] = im[r:sx-r, r:sy-r, r:sz-r]
      return edge
docs: r'''
      Fill in the edges of the input image.
      Used by RSA to ensure that no elements are placed too close to the edge.