@staticmethod
def int_to_bytestring(i, padding=8):
    """
        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 & 255)
        i >>= 8
    return bytes(bytearray(reversed(result)).rjust(padding, b'\x00'))
