<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_rpc_port(port):
 """Validates give port for use as rpc server port. """

    if not port:
        raise NetworkControllerError(desc='Invalid rpc port number.')
    if isinstance(port, str):
        port = int(port)

    if port <= 0:
        raise NetworkControllerError(desc='Invalid rpc port number %s' % port)
    return port