def is_valid_mac(addr):
    """Check the syntax of a given mac address.

    The acceptable format is xx:xx:xx:xx:xx:xx
    """
    addrs = addr.split(':')
    if len(addrs) != 6:
        return False
    for m in addrs:
        try:
            if int(m, 16) > 255:
                return False
        except ValueError:
            return False
    return True
def is_valid_mac ( addr ) : addrs = addr . split ( ':' ) if len ( addrs ) != 6 : return False for m in addrs : try : if int ( m , 16 ) > 255 : return False except ValueError : return False return True
Check the syntax of a given mac address.

    The acceptable format is xx:xx:xx:xx:xx:xx