code: def xy_round(data,x0,y0,skymode,ker2d,xsigsq,ysigsq,datamin=None,datamax=None):
      
      nyk,nxk = ker2d.shape
      if datamin is None:
          datamin = data.min()
      if datamax is None:
          datamax = data.max()
  
      # call C function for speed now...
      xy_val = cdriz.arrxyround(data,x0,y0,skymode,ker2d,xsigsq,ysigsq,datamin,datamax)
      if xy_val is None:
          x = None
          y = None
          round = None
      else:
          x = xy_val[0]
          y = xy_val[1]
          round = xy_val[2]
  
      return x,y,round
docs: Compute center of source
      Original code from IRAF.noao.digiphot.daofind.apfind ap_xy_round()