def is_valid_address (s):
    """
    returns True if address is a valid Bluetooth address

    valid address are always strings of the form XX:XX:XX:XX:XX:XX
    where X is a hexadecimal character.  For example,
        01:23:45:67:89:AB is a valid address, but
        IN:VA:LI:DA:DD:RE is not
    """
    try:
        pairs = s.split (":")
        if len (pairs) != 6: return False
        if not all(0 <= int(b, 16) <= 255 for b in pairs): return False
    except:
        return False
    return True
def is_valid_address ( s ) : try : pairs = s . split ( ":" ) if len ( pairs ) != 6 : return False if not all ( 0 <= int ( b , 16 ) <= 255 for b in pairs ) : return False except : return False return True
returns True if address is a valid Bluetooth address

    valid address are always strings of the form XX:XX:XX:XX:XX:XX
    where X is a hexadecimal character.  For example,
        01:23:45:67:89:AB is a valid address, but
        IN:VA:LI:DA:DD:RE is not