Revision 1862d460 lib/utils.py
b/lib/utils.py | ||
---|---|---|
1055 | 1055 |
""" |
1056 | 1056 |
seen = set() |
1057 | 1057 |
return [i for i in seq if i not in seen and not seen.add(i)] |
1058 |
|
|
1059 |
|
|
1060 |
def IsValidMac(mac): |
|
1061 |
"""Predicate to check if a MAC address is valid. |
|
1062 |
|
|
1063 |
Checks wether the supplied MAC address is formally correct, only |
|
1064 |
accepts colon separated format. |
|
1065 |
""" |
|
1066 |
mac_check = re.compile("^([0-9a-f]{2}(:|$)){6}$") |
|
1067 |
return mac_check.match(mac) is not None |
Also available in: Unified diff