code: def valid_totp(self, code, period=30, timestamp=None):
          
          if not valid_code(code):
              return False
          return compare_digest(
              bytes(self.totp(period, timestamp)),
              bytes(int(code))
          )
docs: Valid a TOTP code.
  
          :param code: A number that is less than 6 characters.
          :param period: A period that a TOTP code is valid in seconds
          :param timestamp: Validate TOTP at this given timestamp