def RANGE(value):
 if (u':' in value):
  (start, stop) = value.split(u':', 1)
  start = UINT(start)
  if stop.strip():
   stop = UINT(stop)
   if (start >= stop):
    raise ValueError(u'End must be larger than start')
  else:
   stop = None
 else:
  start = UINT(value)
  stop = (start + 1)
 return slice(start, stop)

def RANGE ( value ) : if ( u':' in value ) : ( start , stop ) = value . split ( u':' , 1 ) start = UINT ( start ) if stop . strip ( ) : stop = UINT ( stop ) if ( start >= stop ) : raise ValueError ( u'End must be larger than start' ) else : stop = None else : start = UINT ( value ) stop = ( start + 1 ) return slice ( start , stop )
convert a single integer or range spec into a slice n should become slice n: should become slice n:m should become slice and m > n must hold .