Light Attenuation Mask
Part of a larger shading model detailed HERE, this is an example of how to introduce a Light Attenuation Mask into your custom shading model. This model also incorporates elements from View-Direction Based Lighting, though they are not necessary for the mask functionality.
The Light Attenuation node outputs 0 to 1 shadow information onto the surface of an object, basically it's the node that lets objects receive shadows from other objects. The normal implementation method for this node is to multiply it with the diffuse component of your shading model. As more lights are added, the range of the light attenuation node is divided by how many lights are in range of the object. The multiple light-sources cause multiple passes that are added together, because of this, light attenuation must be used last (otherwise your end product will be hyper-bright with multiple lights). The node can also be used as a mask (much like a Photoshop layer mask) to hide or modify other shader effects.
In this example, the Light Attenuation node is multiplied with a Fresnel function resulting in a Fresnel effect that is only visible in the shaded portion of the object.
Shadow Gradient Color, Diff Color, and Brightness values can be changed.