def _mask_token(token: str) -> str:
    """Mask a PAT token for display."""
    if len(token) <= 8:
        # it's not valid anyway, just show the entire thing
        return token
    else:
        return "%s%s%s" % (token[0:4], len(token[4:-4]) * "*", token[-4:])