def _generate_totp_passcode(secret):
 if isinstance(secret, six.text_type):
  secret = secret.encode('utf-8')
 while ((len(secret) % 8) != 0):
  secret = (secret + '=')
 decoded = base64.b32decode(secret)
 totp = crypto_totp.TOTP(decoded, 6, hashes.SHA1(), 30, backend=default_backend())
 return totp.generate(timeutils.utcnow_ts(microsecond=True)).decode('utf-8')

def _generate_totp_passcode ( secret ) : if isinstance ( secret , six . text_type ) : secret = secret . encode ( 'utf-8' ) while ( ( len ( secret ) % 8 ) != 0 ) : secret = ( secret + '=' ) decoded = base64 . b32decode ( secret ) totp = crypto_totp . TOTP ( decoded , 6 , hashes . SHA1 ( ) , 30 , backend = default_backend ( ) ) return totp . generate ( timeutils . utcnow_ts ( microsecond = True ) ) . decode ( 'utf-8' )
generate totp passcode .