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, and checks the validity.
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/python/usage.py/portCoerce