Checking whether an armature has a bone or not (resolved)

Hopefully a simple question: how do I check whether an armature has a bone with a certain name?
I got this:

    armatureobj = scn.objects.active
    armaturedata = armatureobj.getData()
    armbones = armaturedata.bones
    armbone = armbones["a_bone"]
    if armbone:
        #do stuff

But this just gives me the error “KeyError: ‘bone a_bone not found’”. The BonesDict class doesn’t have a has_key() method, nor does it support the “in” keyword (http://docs.python.org/tut/node7.html#SECTION007500000000000000000) so what would be an easy way to check for a bone’s existence?
Thanks in advance.

Nevermind, figured it out. Solution:

    armatureobj = scn.objects.active
    armaturedata = armatureobj.getData()
    armbones = armaturedata.bones
    try:
        armbone = armbones["a_bone"]
    except:
        print "a_bone does not exist"
    else:
        #do stuff