def mac_address(mac, for_item=True):
 if (not isinstance(mac, basestring)):
  raise CX('Invalid input, mac must be a string')
 else:
  mac = mac.lower().strip()
 if (for_item is True):
  if (mac == 'random'):
   return mac
 if (not netaddr.valid_mac(mac)):
  raise CX(('Invalid mac address format (%s)' % mac))
 return mac

def mac_address ( mac , for_item = True ) : if ( not isinstance ( mac , basestring ) ) : raise CX ( 'Invalid input, mac must be a string' ) else : mac = mac . lower ( ) . strip ( ) if ( for_item is True ) : if ( mac == 'random' ) : return mac if ( not netaddr . valid_mac ( mac ) ) : raise CX ( ( 'Invalid mac address format (%s)' % mac ) ) return mac
validate as an eternet mac address .