def _str2int(num):
 if (not num):
  return None
 if num.isdigit():
  return int(num)
 if (not re.match('\\w\\w:\\w\\w:\\w\\w', num)):
  return None
 try:
  return int(num.replace(':', ''), 16)
 except ValueError:
  return None

def _str2int ( num ) : if ( not num ) : return None if num . isdigit ( ) : return int ( num ) if ( not re . match ( '\\w\\w:\\w\\w:\\w\\w' , num ) ) : return None try : return int ( num . replace ( ':' , '' ) , 16 ) except ValueError : return None
convert a string into an integer .