import pwd


def username_from_uid(uid: int) -> str:
    """Convert a UID to a username."""
    try:
        username = pwd.getpwuid(uid).pw_name.replace(".", "__")
    except KeyError:
        username = f"__unknown_uid_{uid}__"
    return username