What's the best way to validate that an IP entered by the user is valid?  It comes in as a string.
I only needed to parse IP v4 addresses. My solution based on Chills strategy follows:

def getIP():
    valid = False
    while not valid :
        octets = raw_input( "Remote Machine IP Address:" ).strip().split(".")
        try: valid=len( filter( lambda(item):0<=int(item)<256, octets) ) == 4
        except: valid = False
    return ".".join( octets )
How to validate IP address in Python?