To elaborate on my comment..
If you're calling the method, self is implicit. That counts as one argument. And you have another parameter named device. That is the other argument, hence it expects two arguments. If at some point you want to accept no arguments aside from the implicit self argument, you can use *args like this:
def code(self, *args):
Or you can use a default value for the parameter like this:
def code(self, device=''):