It looks like you are implementing the "Guard" subregion correction. Another option is where you assume a "minimum distance" neighbor to the boundary observations and incorporate these values into the NNI. Other options are the "Donnelly" rectangular correction and the "Kaplan-Meier" correction that uses a cumulative distribution function.
I would pose the question: if you are going to the trouble of "re-creating" the NNI statistic (I assume in Python) then why are you not implementing a more modern counterpart (i.e., K, G-hat, F-hat) that accounts for the know limitations of the Clarke-Evans NNI? ESRI has developed methods for linking R and ArcGIS (through Python) that could be leveraged to provide a suite of well developed PPA statistics.
I would recommend the following readings in point pattern statistics and the NNI:
Baddeley, A.J. and Gill, R.D. (1997) Kaplan-Meier estimators of interpoint distance distributions for spatial point processes. Annals of Statistics 25:263-292.
Cressie, N.A.C. (1991) Statistics for spatial data. John Wiley and Sons, 1991.
Diggle, P.J. (1983) Statistical analysis of spatial point patterns. Academic Press.
Donnelly, K. (1978) Simulations to determine the variance and edge-effect of total nearest neighbour distance. In Simulation methods in archaeology, Cambridge University Press, pp 91�??95.
Hanisch, K.-H. (1984) Some remarks on estimators of the distribution function of nearest-neighbour distance in stationary spatial point patterns. Statistics 15:409�??412.
Ripley, B.D. (1988) Statistical inference for spatial processes. Cambridge University Press.