Is it possible to tag a variable and lookup based on that tag?
<p>Is it possible to "tag" a variable in python in some way so that I could easily reference it multiple times? I am trying to run a script that would check network device configs for various security rules, i.e;</p>

<pre><code>rule1 = 'ip ssh version 2' !IOS , CORE, DIST, ACCESS
rule1a = 'ssh server v2' !IOS-XR , CORE, DIST, ACCESS
rule1b = 'feature ssh' !NXOS, DATACTR
rule2 = 'enable secret' !IOS, CORE, DIST
</code></pre>

<p>and then in my script search for the tags and look for those lines associated so that it would search thru a configuration file for all things associated with IOS and CORE or would I need to create something like a class object for each rule?</p>

<pre><code>class Rule(object):
    def __init__(self, platform, layer, checkline)
        self.platform = platform
        self.layer = layer
        self.checkline = checkline
def make_rule(platform, layer, checkline)
    rule = Rule(nxos, dist, feature ssh)
</code></pre>

<p>Edit:
I have 100s of rules and they each are slightly different based on what they will apply to, mainly different texts for OS but some only apply based on if they are core devices hence my desire to only create 1 rule per OS and then be able to use other attributes assigned to reference that variable vs writing up to 12X the variables: once per os flavor and once per layer in the network.</p>