Driver variable prop (ID-block) : referencing the current object
In blender 2.78 (and maybe earlier) there is now the use_self option when setting up a driver.



And with a test script 

import bpy

def x(self):
    print(self)
    print(getattr(self, "location", None))
    return 0.0

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


After adding the driver expression x(self) to a driver on a cone mesh and a material's emit it prints the following to the system console

&lt;bpy_struct, Material("Material")&gt;
None
&lt;bpy_struct, Object("Cone")&gt;
&lt;Vector (0.0000, 0.0000, 0.0000)&gt;


and to return  custom prop value, or 0 if there is no custom prop of that name.

def x(self):
    prop = self.get("toggleRedWhite", 0.0)
    return prop


PS. the data_path of a custom property is '["toggleRedWhite"]' How can I add drivers for custom properties?