Scripting: Is there a way to test if an object has shape-keys?
Access shape key data via the object.data.shape_keys object, and the actual shape key blocks through object.data.shape_keys.key_blocks collection:

import bpy
# Reference active object
o = bpy.context.object

# Check if object has any shape keys at all (will be None if not)
if o.data.shape_keys:
    num_of_SK_blocks = len( o.data.shape_keys.key_blocks )
    print( "Number of shape keys: ", num_of_SK_blocks )