ros python service server

#!/usr/bin/env python

from beginner_tutorials.srv import AddTwoInts,AddTwoIntsResponse
import rospy

def handle_add_two_ints(req):
    print "Returning [%s + %s = %s]"%(req.a, req.b, (req.a + req.b))
    return AddTwoIntsResponse(req.a + req.b)

def add_two_ints_server():
    s = rospy.Service('add_two_ints', AddTwoInts, handle_add_two_ints)
    print "Ready to add two ints."

if __name__ == "__main__":

Here is what the above code is Doing:
1. The first line of the code imports the service message type AddTwoInts.
2. The second line imports the service type AddTwoInts.
3. The third line imports the service type AddTwoIntsResponse.
4. The fourth line imports the Python library rospy.
5. The fifth line defines a callback function to handle requests.
6. The sixth line initializes the node.
7. The seventh line creates a Service named add_two_ints with the defined callback function.
8. The eighth line prints a message to the console, notifying the user that the service is ready.
9. The ninth line keeps the node from exiting until the service is shut down.
10. The last line checks if the file is being run as a script.