def getHwAddr(ifname):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
info = fcntl.ioctl(s.fileno(), 35111, struct.pack('256s', ifname[:15]))
return ':'.join([('%02x' % ord(char)) for char in info[18:24]])
print(getHwAddr('eth0'))
Getting MAC Address