Add a Reset method to DBusMockObject

This method is accessible over D-Bus and will reset that object’s
state (including removing all its sub-objects) as if the object had
been destroyed and re-created. If the object was originally created
with a template, its methods and interfaces (etc.) will be re-loaded
from the template.

This is intended for use at the end of test suites to reset state
before the next unit test is run, as an alternative to killing
python-dbusmock and re-starting it (which is more expensive).
Centralise code for adding a method to a D-Bus object

Now it’s all done in AddMethod, rather than having some fairly
icky Python duplicated in a couple of places.

This also adds a check to ensure that D-Bus signals from a
template are not added as methods to the mock D-Bus object.
Allow Python functions to be passed to AddMethod from Python code

If running a test from within Python, it’s convenient to be able to
add methods by passing in a Python function handle, rather than
just a string.

This can also be used from within template files, which allows for
more complex behaviour than can be fitted in a string of inline code.

This is necessary to be able to add methods to objects which are
not the main object in a template file.
Add documentation for DBusMockObject.MethodCalled
Don’t close the log file multiple times if it’s shared between objects

If there are multiple DBusMockObjects which share the same log file,
and any one of them is destroyed, the log file will be closed for all.
Instead, only allow the top-most DBusMockObject to close the log file,
as it should be the final object on the bus.
Add Reset() mock interface method
      
This resets that object’s state (including removing all its sub-objects) as if
the object or template had been destroyed and re-created. This is intended for
use at the end of test cases to reset state before the next test case is run,
as an alternative to killing python-dbusmock and re-starting it.

Patch by Philip Whitnall, tests by Martin Pitt.
logind template: Fix return value of CanSuspend() and related methods, calling them previously caused a crash.
Allow Python functions to be passed to AddMethod() from Python code

If running a test from within Python, it’s convenient to be able to add methods
by passing in a Python function handle, rather than just a string.
      
This can also be used from within template files, which allows for more complex
behaviour than can be fitted in a string of inline code.
	    
This is necessary to be able to add methods to objects which are not the main
object in a template file.

Patch by Philip Withnall.
Centralise code for adding a method to a D-Bus object

Now it’s all done in AddMethod, rather than having some fairly icky Python
duplicated in a couple of places.
    
This also adds a check to ensure that D-Bus signals from a template are
not added as methods to the mock D-Bus object.

Patch by Philip Withnall.
Add documentation for DBusMockObject.MethodCalled

Patch by Philip Withnall.
Don't close the log file multiple times if it's shared between objects

If there are multiple DBusMockObjects which share the same log file, and any
one of them is destroyed, the log file will be closed for all.  Instead, only
allow the top-most DBusMockObject to close the log file, as it should be the
final object on the bus.

Patch by Philip Withnall.
Log calls to Get(), GetAll(), and Set() D-BUS property methods.

Original patch by Philip Withnall, modified and tests added by Martin Pitt.