code: def AddMethod(self, interface, name, in_sig, out_sig, code):
          '''Add a method to this object
          interface: D-Bus interface to add this to. For convenience you can
                     specify '' here to add the method to the object's main
                     interface (as specified on construction).
          name: Name of the method
          in_sig: Signature of input arguments; for example "ias" for a method
                  that takes an int32 and a string array as arguments; see
                  http://dbus.freedesktop.org/doc/dbus-specification.html
          out_sig: Signature of output arguments; for example "s" for a method
                   that returns a string; use '' for methods that do not return
                   anything.
          code: Python 3 code to run in the method call; you have access to the
                arguments through the "args" list, and can set the return value
                by assigning a value to the "ret" variable. You can also read the
                global "objects" variable, which is a dictionary mapping object
                paths to DBusMockObject instances.
                For keeping state across method calls, you are free to use normal
                Python members of the "self" object, which will be persistent for
                the whole mock's life time. E. g. you can have a method with
                "self.my_state = True", and another method that returns it with
                "ret = self.my_state".
                When specifying '', the method will not do anything (except
                logging) and return None.
          '''
          if not interface:
              interface = self.interface
          n_args = len(dbus.Signature(in_sig))
          method = lambda self, *args, **kwargs: DBusMockObject.mock_method(
              self, interface, name, in_sig, *args, **kwargs)
          dbus_method = dbus.service.method(interface,
                                            out_signature=out_sig)(method)
          dbus_method.__name__ = str(name)
          dbus_method._dbus_in_signature = in_sig
          dbus_method._dbus_args = ['arg%i' % i for i in range(1, n_args + 1)]
          if interface == self.interface:
              setattr(self.__class__, name, dbus_method)
          self.methods.setdefault(interface, {})[str(name)] = (in_sig, out_sig, code, dbus_method)