def isIP(addr):
    '''Return an IP instance for a valid IP address, None otherwise.
    '''
    try:
        return IP(addr)
    except (TypeError, ValueError):
        return None
Return an IP instance for a valid IP address, None otherwise.
    
recipes/Python/577191_IP_and_MAC_addresses/recipe-577191.py