def parse_network_vlan_range(network_vlan_range):
 entry = network_vlan_range.strip()
 if (':' in entry):
  if (entry.count(':') != 2):
   raise n_exc.NetworkVlanRangeError(vlan_range=entry, error=_('Need exactly two values for VLAN range'))
  (network, vlan_min, vlan_max) = entry.split(':')
  if (not network):
   raise n_exc.PhysicalNetworkNameError()
  try:
   vlan_min = int(vlan_min)
  except ValueError:
   raise_invalid_tag(vlan_min, entry)
  try:
   vlan_max = int(vlan_max)
  except ValueError:
   raise_invalid_tag(vlan_max, entry)
  vlan_range = (vlan_min, vlan_max)
  verify_vlan_range(vlan_range)
  return (network, vlan_range)
 else:
  return (entry, None)

def parse_network_vlan_range ( network_vlan_range ) : entry = network_vlan_range . strip ( ) if ( ':' in entry ) : if ( entry . count ( ':' ) != 2 ) : raise n_exc . NetworkVlanRangeError ( vlan_range = entry , error = _ ( 'Need exactly two values for VLAN range' ) ) ( network , vlan_min , vlan_max ) = entry . split ( ':' ) if ( not network ) : raise n_exc . PhysicalNetworkNameError ( ) try : vlan_min = int ( vlan_min ) except ValueError : raise_invalid_tag ( vlan_min , entry ) try : vlan_max = int ( vlan_max ) except ValueError : raise_invalid_tag ( vlan_max , entry ) vlan_range = ( vlan_min , vlan_max ) verify_vlan_range ( vlan_range ) return ( network , vlan_range ) else : return ( entry , None )
interpret a string as network[:vlan_begin:vlan_end] .