code: def generate_twofactor_code_for_time(shared_secret, timestamp):
      
      hmac = hmac_sha1(bytes(shared_secret),
                       struct.pack('>Q', int(timestamp)//30))  # this will NOT stop working in 2038
  
      start = ord(hmac[19:20]) & 0xF
      codeint = struct.unpack('>I', hmac[start:start+4])[0] & 0x7fffffff
  
      charset = '23456789BCDFGHJKMNPQRTVWXY'
      code = ''
  
      for _ in range(5):
          codeint, i = divmod(codeint, len(charset))
          code += charset[i]
  
      return code
docs: Generate Steam 2FA code for timestamp
  
      :param shared_secret: authenticator shared secret
      :type shared_secret: bytes
      :param timestamp: timestamp to use, if left out uses current time
      :type timestamp: int
      :return: steam two factor code
      :rtype: str