I am using Python 2.7 on Linux. I need to get local IP address (here it is 172.16.x.x). I can get IP address and it's corresponding netmask address but I'm not able to get broadcast IP address for the same IP.
If you are able to get the IP and the Subnetmask, you could simply calculate the Broadcastadress, by binary ORing the IP adress and the inverted subnetmask. 
BC = ipadress || inv(subnetmask)
How to find Broadcast IP address from local IP address?