routerbox/utils/he_ipv6/utils.py

11 lines
264 B
Python
Raw Permalink Normal View History

2020-05-14 17:11:47 -04:00
def xml2bool(xml_str):
if xml_str is None:
return(None)
xml_str = xml_str.lower()[0]
if xml_str in ('t', '1'):
return(True)
elif xml_str in ('f', '0'):
return(False)
else:
raise ValueError('Not a boolean value')