import base64
import struct


def tiny_id(page_id):
    """Return *tiny link* ID for the given page ID."""
    return base64.b64encode(struct.pack('<L', int(page_id)).rstrip(b'\0'), altchars=b'_-').rstrip(b'=').decode('ascii')