def string_to_dimension_level(astring):
 if (not astring):
  raise ArgumentError('Drilldown string should not be empty')
 ident = '[\\w\\d_]'
 pattern = ('(?P<dim>%s+)(@(?P<hier>%s+))?(:(?P<level>%s+))?' % (ident, ident, ident))
 match = re.match(pattern, astring)
 if match:
  d = match.groupdict()
  return (d['dim'], d['hier'], d['level'])
 else:
  raise ArgumentError(("String '%s' does not match drilldown level pattern 'dimension@hierarchy:level'" % astring))

def string_to_dimension_level ( astring ) : if ( not astring ) : raise ArgumentError ( 'Drilldown string should not be empty' ) ident = '[\\w\\d_]' pattern = ( '(?P<dim>%s+)(@(?P<hier>%s+))?(:(?P<level>%s+))?' % ( ident , ident , ident ) ) match = re . match ( pattern , astring ) if match : d = match . groupdict ( ) return ( d [ 'dim' ] , d [ 'hier' ] , d [ 'level' ] ) else : raise ArgumentError ( ( "String '%s' does not match drilldown level pattern 'dimension@hierarchy:level'" % astring ) )
converts astring into a dimension level tuple .