Check if active object has a modifier
Check object for modifiers

import bpy

obj = bpy.context.object

if not obj.modifiers:
    print ("no modifiers")
else:
    print ("object has modifier(s)")


Check object for specific modifiers

import bpy

obj = bpy.context.object

for modifier in obj.modifiers:
    if modifier.type == "SUBSURF":
        print ("subsurf")


For all types see: http://www.blender.org/api/blender_python_api_current/bpy.types.Modifier.html?highlight=subsurf#bpy.types.Modifier.type



In your case I'd recommend using a list comprehension which returns True or False:

print(0 &lt; len([m for m in bpy.context.object.modifiers if m.type == "SUBSURF"]))


or Python's any() plus the list comprehension.

print(any([m for m in bpy.context.object.modifiers if m.type == "SUBSURF"]))




Adding the Modifier if it isn't present

import bpy

obj = bpy.context.active_object
subsurf = obj.modifiers.new(name='MySubSurf', type='SUBSURF')
subsurf.levels = 2
subsurf.render_levels = 3