Generate a Python program that has the following intention:

The intention of the program is to perform modular exponentiation.

The function p1(a, b) takes two arguments, a and b, and returns the result of raising a to the power of b modulo b. In other words, it calculates a^b % b.

The function uses recursion to perform the calculation. If b is not equal to 0, it calls itself with the arguments a % b and b, which calculates (a % b)^b % b. This continues until b is 0, at which point the function returns the result of the final calculation, which is a.

This function can be useful in cryptography and other applications where modular arithmetic is used. Please repeat the request first, then give your response.
user