def Port(port):
  """Sanitize a port value.
   
  Args:
    port: a port value

  Returns:
    port: a port value

  Raises:
    BadPortValue: port is not valid integer or string
    BadPortRange: port is outside valid range
  """
  pval = -1
  try:
    pval = int(port)
  except __HOLE__:
    raise BadPortValue('port %s is not valid.' % port)
  if pval < 0 or pval > 65535:
    raise BadPortRange('port %s is out of range 0-65535.' % port)
  return pval
dataset/ETHPy150Open google/capirca/lib/port.py/Port