def is_netaddr():
  def validator(form, value):
    items = value.split()
    if len(items) > 1:
      raise ValidationError(_(u'You have to enter a valid net address.'))
    items = items[0].split(':')
    if len(items) not in (1, 2):
      raise ValidationError(_(u'You have to enter a valid net address.'))
    elif len(items) == 2 and not items[1].isdigit():
      raise ValidationError(_(u'The port has to be numeric'))
  return validator
Checks if the string given is a net address.  Either an IP or a
dataset/ETHPy150Open IanLewis/kay/kay/utils/validators.py/is_netaddr