def scope2index(scope, descr, where=None):
 try:
  return scopes.index(scope)
 except ValueError:
  raise ValueError("{0} {1}has an unsupported scope value '{2}'".format(descr, ('from {0} '.format(where) if where else ''), scope))

def scope2index ( scope , descr , where = None ) : try : return scopes . index ( scope ) except ValueError : raise ValueError ( "{0} {1}has an unsupported scope value '{2}'" . format ( descr , ( 'from {0} ' . format ( where ) if where else '' ) , scope ) )
look up the index of scope and raise a descriptive value error if not defined .