def portCoerce(value):
 value = int(value)
 if ((value < 0) or (value > 65535)):
  raise ValueError(('Port number not in range: %s' % (value,)))
 return value

def portCoerce ( value ) : value = int ( value ) if ( ( value < 0 ) or ( value > 65535 ) ) : raise ValueError ( ( 'Port number not in range: %s' % ( value , ) ) ) return value
coerce a string value to an int port number .