I think you want to swap the if conditions:
def fnt(a,b,c=None):
  if c != None:
    res = a+b+c  //c is not None, so use it. 
  else:
   res = a+b  //forget c as it is None
 return res

Also use torch.add method to add the tensors.