def generate_otp(self, input: int) -> str:
        """
        :param input: the HMAC counter value to use as the OTP input.
        Usually either the counter, or the computed integer based on the Unix timestamp
        """
        if input < 0:
            raise ValueError("input must be positive integer")
        hasher = hmac.new(
            self.byte_secret(), self.int_to_bytestring(input), self.digest
        )
        hmac_hash = bytearray(hasher.digest())
        offset = hmac_hash[-1] & 0xF
        code = (
            (hmac_hash[offset] & 0x7F) << 24
            | (hmac_hash[offset + 1] & 0xFF) << 16
            | (hmac_hash[offset + 2] & 0xFF) << 8
            | (hmac_hash[offset + 3] & 0xFF)
        )
        str_code = str(code % 10**self.digits)
        while len(str_code) < self.digits:
            str_code = "0" + str_code
        return str_code

        :param input: the HMAC counter value to use as the OTP input.
        Usually either the counter, or the computed integer based on the Unix timestamp
        
instagrapi/mixins/totp.py