```python >>> import uuid, base64 >>> base64.urlsafe_b64encode(uuid.uuid4().bytes).rstrip(b'=').decode('ascii') 'moCYzJVCQySDcN98C1Icfg' ``` Nicer and shorter.
Nicer and shorter.