Error when Adding a Python Script to a Driver
For a single property type driver variable you need also to set the path value.  For example



import bpy

def x(name):
    print(name)
    return 0

bpy.app.driver_namespace["x"] = x


for example shown prints "Lamp", the name of the lamp object, to the console.  Ok, string properties can be passed via driver variables.  (personally don't recommend it) (note also for this case, the expression could simply be x("Lamp") with no need for a driver variable)  

Not setting path for the single property driver variable will result in "None" being printed to console.

Ok, now that we know a name can be passed, it's best to check for errors with something like,

if name is None:
    print("problem with name variable")
    return 0

obj = bpy.context.scene.objects.get(name)

if obj is None:
    print("no object named:", name)
    return 0


as errors will mark the driver as "bad" which can result it in being turned off.

A more usual way would be, where the x Euler rotation of the Lamp object, is passed as a float variable, "var", to the expression floor(2 * var / pi).



PS also of note is that rotation in blender is in radians.