code: def valid_hotp(self, code, last=0, trials=100):
          
          if not valid_code(code):
              return False
  
          code = bytes(int(code))
          for i in range(last + 1, last + trials + 1):
              if compare_digest(bytes(self.hotp(counter=i)), code):
                  return i
          return False
docs: Valid a HOTP code.
  
          :param code: A number that is less than 6 characters.
          :param last: Guess HOTP code from last + 1 range.
          :param trials: Guest HOTP code end at last + trials + 1.