def get_mac_address(iface):
 proc = Popen(['ifconfig', iface], stdout=PIPE, stderr=DN)
 proc.wait()
 mac = ''
 first_line = proc.communicate()[0].split('\n')[0]
 for word in first_line.split(' '):
  if (word != ''):
   mac = word
 if (mac.find('-') != (-1)):
  mac = mac.replace('-', ':')
 if (len(mac) > 17):
  mac = mac[0:17]
 return mac

def get_mac_address ( iface ) : proc = Popen ( [ 'ifconfig' , iface ] , stdout = PIPE , stderr = DN ) proc . wait ( ) mac = '' first_line = proc . communicate ( ) [ 0 ] . split ( '\n' ) [ 0 ] for word in first_line . split ( ' ' ) : if ( word != '' ) : mac = word if ( mac . find ( '-' ) != ( - 1 ) ) : mac = mac . replace ( '-' , ':' ) if ( len ( mac ) > 17 ) : mac = mac [ 0 : 17 ] return mac
returns mac address of "iface" .