def int_to_bytestring(i: int, padding: int = 8) -> bytes:
        """
        Turns an integer to the OATH specified
        bytestring, which is fed to the HMAC
        along with the secret
        """
        result = bytearray()
        while i != 0:
            result.append(i & 0xFF)
            i >>= 8
            # It's necessary to convert the final result from bytearray to bytes
            # because the hmac functions in python 2.6 and 3.3 don't work with
            # bytearray
        return bytes(bytearray(reversed(result)).rjust(padding, b"\0"))

        Turns an integer to the OATH specified
        bytestring, which is fed to the HMAC
        along with the secret
        
instagrapi/mixins/totp.py