MonkeyPatch: fix applying and reverting (static|class)methods.

When applying a patch to a class we should cast the method we are
patching with to be of the same kind (staticmethod, instancemethod
or classmethod) as the original method that we are replacing. (Note
that by default setattr sets those methods as instancemethods).

In Python2, setattr(Class, name, func) automatically converts func
into an instancemethod. To keep type(Class.func) as function,
staticmethod(func) must be applied explicitly when reverting.

Credit goes to Nir Soffer or the final version of the patch and tests.

Change-Id: Ie3100455ab761481f57a93ab8aacc34ac4ab91eb
Signed-off-by: Antoni S. Puimedon <asegurap@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/23378
Reviewed-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/25058