def lookup(self, vtype, vname, target_id=None):
        """Return value of vname from the variable store vtype.

        Valid vtypes are `strings` 'counters', and `pending`. If the value
        is not found in the current steps store, earlier steps will be
        checked. If not found, '', 0, or (None, None) is returned.
        """
        nullvals = {'strings': '', 'counters': 0, 'pending': (None, None)}
        nullval = nullvals[vtype]
        vstyle = None

        if vtype == 'counters':
            if len(vname) > 1:
                vname, vstyle = vname
            else:
                vname = vname[0]

        if target_id is not None:
            try:
                state = self.state[vtype][target_id]
                steps = self.state[vtype][target_id].keys()
            except KeyError:
                log(WARN, u'Bad ID target lookup {}'.format(
                    target_id).encode('utf-8'))
                return nullval

        else:
            state = self.state
            steps = self.state['scope']

        for step in steps:
            if vname in state[step][vtype]:
                if vtype == 'pending':
                    return(state[step][vtype][vname], step)
                else:
                    val = state[step][vtype][vname]
                    if vstyle is not None:
                        return self.counter_style(val, vstyle)
                    return val
        else:
            return nullval
def lookup ( self , vtype , vname , target_id = None ) : nullvals = { 'strings' : '' , 'counters' : 0 , 'pending' : ( None , None ) } nullval = nullvals [ vtype ] vstyle = None if vtype == 'counters' : if len ( vname ) > 1 : vname , vstyle = vname else : vname = vname [ 0 ] if target_id is not None : try : state = self . state [ vtype ] [ target_id ] steps = self . state [ vtype ] [ target_id ] . keys ( ) except KeyError : log ( WARN , u'Bad ID target lookup {}' . format ( target_id ) . encode ( 'utf-8' ) ) return nullval else : state = self . state steps = self . state [ 'scope' ] for step in steps : if vname in state [ step ] [ vtype ] : if vtype == 'pending' : return ( state [ step ] [ vtype ] [ vname ] , step ) else : val = state [ step ] [ vtype ] [ vname ] if vstyle is not None : return self . counter_style ( val , vstyle ) return val else : return nullval
Return value of vname from the variable store vtype.

        Valid vtypes are `strings` 'counters', and `pending`. If the value
        is not found in the current steps store, earlier steps will be
        checked. If not found, '', 0, or (None, None) is returned.