Python: Checking whether a certain shapekey exists at active mesh
You can test whether a collection has an item named 'foo' with 'foo' in collection. So
def active_object_has_keyblock(name):
    ob = bpy.context.active_object
    if not ob or ob.type != 'MESH':
        return False

    mesh = ob.data
    if not mesh.shape_keys:
        return False

    return name in mesh.shape_keys.key_blocks