original_docstring: Check if given token is valid for given secret. Return interval number
      that was successful, or False if not found.
  
      :param token: token being checked
      :type token: int or str
      :param secret: secret for which token is checked
      :type secret: str
      :param last: last used interval (start checking with next one)
      :type last: int
      :param trials: number of intervals to check after 'last'
      :type trials: int
      :param digest_method: method of generating digest (hashlib.sha1 by default)
      :type digest_method: callable
      :param token_length: length of the token (6 by default)
      :type token_length: int
      :return: interval number, or False if check unsuccessful
      :rtype: int or bool
  
      >>> secret = b'MFRGGZDFMZTWQ2LK'
      >>> valid_hotp(713385, secret, last=1, trials=5)
      4
      >>> valid_hotp(865438, secret, last=1, trials=5)
      False
      >>> valid_hotp(713385, secret, last=4, trials=5)
      False
      
docstring: Check if given token is valid for given secret. Return interval number
  that was successful, or False if not found.
docstring_tokens: Check if given token is valid for given secret . Return interval number that was successful or False if not found .
code: def valid_hotp(
          token,
          secret,
          last=1,
          trials=1000,
          digest_method=hashlib.sha1,
          token_length=6,
  ):
      """Check if given token is valid for given secret. Return interval number
      that was successful, or False if not found.
  
      :param token: token being checked
      :type token: int or str
      :param secret: secret for which token is checked
      :type secret: str
      :param last: last used interval (start checking with next one)
      :type last: int
      :param trials: number of intervals to check after 'last'
      :type trials: int
      :param digest_method: method of generating digest (hashlib.sha1 by default)
      :type digest_method: callable
      :param token_length: length of the token (6 by default)
      :type token_length: int
      :return: interval number, or False if check unsuccessful
      :rtype: int or bool
  
      >>> secret = b'MFRGGZDFMZTWQ2LK'
      >>> valid_hotp(713385, secret, last=1, trials=5)
      4
      >>> valid_hotp(865438, secret, last=1, trials=5)
      False
      >>> valid_hotp(713385, secret, last=4, trials=5)
      False
      """
      if not _is_possible_token(token, token_length=token_length):
          return False
      for i in six.moves.xrange(last + 1, last + trials + 1):
          token_candidate = get_hotp(
              secret=secret,
              intervals_no=i,
              digest_method=digest_method,
              token_length=token_length,
          )
          if token_candidate == int(token):
              return i
      return False
code_tokens: def valid_hotp ( token , secret , last = 1 , trials = 1000 , digest_method = hashlib . sha1 , token_length = 6 , ) : if not _is_possible_token ( token , token_length = token_length ) : return False for i in six . moves . xrange ( last + 1 , last + trials + 1 ) : token_candidate = get_hotp ( secret = secret , intervals_no = i , digest_method = digest_method , token_length = token_length , ) if token_candidate == int ( token ) : return i return False
short_docstring: Check if given token is valid for given secret.
short_docstring_tokens: Check if given token is valid for given secret .
comment: """Check if given token is valid for given secret. Return interval number
      that was successful, or False if not found.
  
      :param token: token being checked
      :type token: int or str
      :param secret: secret for which token is checked
      :type secret: str
      :param last: last used interval (start checking with next one)
      :type last: int
      :param trials: number of intervals to check after 'last'
      :type trials: int
      :param digest_method: method of generating digest (hashlib.sha1 by default)
      :type digest_method: callable
      :param token_length: length of the token (6 by default)
      :type token_length: int
      :return: interval number, or False if check unsuccessful
      :rtype: int or bool
  
      >>> secret = b'MFRGGZDFMZTWQ2LK'
      >>> valid_hotp(713385, secret, last=1, trials=5)
      4
      >>> valid_hotp(865438, secret, last=1, trials=5)
      False
      >>> valid_hotp(713385, secret, last=4, trials=5)
      False
      """